PageRenderTime 81ms CodeModel.GetById 38ms RepoModel.GetById 0ms app.codeStats 0ms

/views/p3MediaTranslation/_toolbar.php

https://github.com/schmunk42/p3media
PHP | 226 lines | 210 code | 10 blank | 6 comment | 19 complexity | c8297cb159fb20ce264d36c25205dc31 MD5 | raw file
  1. <?php Yii::beginProfile('P3MediaTranslation.view.toolbar'); ?>
  2. <?php
  3. $showDeleteButton = (Yii::app()->request->getParam("id")) ? true : false;
  4. $showManageButton = true;
  5. $showCreateButton = true;
  6. $showUpdateButton = true;
  7. $showCancelButton = true;
  8. $showSaveButton = true;
  9. $showViewButton = true;
  10. switch ($this->action->id) {
  11. case "admin":
  12. $showCancelButton = false;
  13. $showSaveButton = false;
  14. $showViewButton = false;
  15. $showUpdateButton = false;
  16. break;
  17. case "update":
  18. $showCreateButton = false;
  19. $showUpdateButton = false;
  20. break;
  21. case "create":
  22. $showCreateButton = false;
  23. $showViewButton = false;
  24. $showUpdateButton = false;
  25. break;
  26. case "view":
  27. $showViewButton = false;
  28. $showSaveButton = false;
  29. $showCreateButton = false;
  30. break;
  31. }
  32. ?>
  33. <div class="clearfix">
  34. <div class="btn-toolbar pull-right">
  35. <!-- relations -->
  36. <div class="btn-group">
  37. <?php $this->widget(
  38. 'bootstrap.widgets.TbButtonGroup',
  39. array(
  40. 'size' => 'large',
  41. 'buttons' => array(
  42. array(
  43. #'label'=>Yii::t('P3MediaModule.crud','Relations'),
  44. 'icon' => 'icon-random',
  45. 'items' => array(
  46. array(
  47. 'icon' => 'circle-arrow-left',
  48. 'label' => Yii::t('p3MediaModule.model', 'relation.P3Media'),
  49. 'url' => array('/p3media/p3Media/admin')
  50. ),
  51. )
  52. ),
  53. ),
  54. )
  55. );
  56. ?> </div>
  57. <div class="btn-group">
  58. <?php
  59. $this->widget(
  60. "bootstrap.widgets.TbButton",
  61. array(
  62. "label" => Yii::t("P3MediaModule.crud", "Manage"),
  63. "icon" => "icon-list-alt",
  64. "size" => "large",
  65. "url" => array("admin"),
  66. "visible" => $showManageButton && (Yii::app()->user->checkAccess(
  67. "P3media.P3MediaTranslation.*"
  68. ) || Yii::app()->user->checkAccess("P3media.P3MediaTranslation.View"))
  69. )
  70. );
  71. ?> </div>
  72. </div>
  73. <div class="btn-toolbar pull-left">
  74. <div class="btn-group">
  75. <?php
  76. $this->widget(
  77. "bootstrap.widgets.TbButton",
  78. array(
  79. #"label"=>Yii::t("P3MediaModule.crud","Cancel"),
  80. "icon" => "chevron-left",
  81. "size" => "large",
  82. "url" => (isset($_GET["returnUrl"])) ? $_GET["returnUrl"] : array("{$this->id}/admin"),
  83. "visible" => $showCancelButton && (Yii::app()->user->checkAccess(
  84. "P3media.P3MediaTranslation.*"
  85. ) || Yii::app()->user->checkAccess("P3media.P3MediaTranslation.View")),
  86. "htmlOptions" => array(
  87. "class" => "search-button",
  88. "data-toggle" => "tooltip",
  89. "title" => Yii::t("P3MediaModule.crud", "Cancel"),
  90. )
  91. )
  92. );
  93. $this->widget(
  94. "bootstrap.widgets.TbButton",
  95. array(
  96. "label" => Yii::t("P3MediaModule.crud", "Create"),
  97. "icon" => "icon-plus",
  98. "size" => "large",
  99. "type" => "success",
  100. "url" => array("create"),
  101. "visible" => $showCreateButton && (Yii::app()->user->checkAccess(
  102. "P3media.P3MediaTranslation.*"
  103. ) || Yii::app()->user->checkAccess("P3media.P3MediaTranslation.Create"))
  104. )
  105. );
  106. $this->widget(
  107. "bootstrap.widgets.TbButton",
  108. array(
  109. "label" => Yii::t("P3MediaModule.crud", "Delete"),
  110. "type" => "danger",
  111. "icon" => "icon-trash icon-white",
  112. "size" => "large",
  113. "htmlOptions" => array(
  114. "submit" => array(
  115. "delete",
  116. "id" => $model->{$model->tableSchema->primaryKey},
  117. "returnUrl" => (Yii::app()->request->getParam("returnUrl")) ? Yii::app(
  118. )->request->getParam("returnUrl") : $this->createUrl("admin")
  119. ),
  120. "confirm" => Yii::t("P3MediaModule.crud", "Do you want to delete this item?")
  121. ),
  122. "visible" => $showDeleteButton && (Yii::app()->user->checkAccess(
  123. "P3media.P3MediaTranslation.*"
  124. ) || Yii::app()->user->checkAccess("P3media.P3MediaTranslation.Delete"))
  125. )
  126. );
  127. $this->widget(
  128. "bootstrap.widgets.TbButton",
  129. array(
  130. #"label"=>Yii::t("P3MediaModule.crud","Update"),
  131. "icon" => "icon-edit",
  132. "type" => "primary",
  133. "size" => "large",
  134. "url" => array("update", "id" => $model->{$model->tableSchema->primaryKey}),
  135. "visible" => $showUpdateButton && (Yii::app()->user->checkAccess(
  136. "P3media.P3MediaTranslation.*"
  137. ) || Yii::app()->user->checkAccess("P3media.P3MediaTranslation.Update"))
  138. )
  139. );
  140. $this->widget(
  141. "bootstrap.widgets.TbButton",
  142. array(
  143. #"label"=>Yii::t("P3MediaModule.crud","View"),
  144. "icon" => "icon-eye-open",
  145. "size" => "large",
  146. "url" => array("view", "id" => $model->{$model->tableSchema->primaryKey}),
  147. "visible" => $showViewButton && (Yii::app()->user->checkAccess(
  148. "P3media.P3MediaTranslation.*"
  149. ) || Yii::app()->user->checkAccess("P3media.P3MediaTranslation.View")),
  150. "htmlOptions" => array(
  151. "data-toggle" => "tooltip",
  152. "title" => Yii::t("P3MediaModule.crud", "View Mode"),
  153. )
  154. )
  155. );
  156. $this->widget(
  157. "bootstrap.widgets.TbButton",
  158. array(
  159. "label" => Yii::t("P3MediaModule.crud", "Save"),
  160. "icon" => "save",
  161. "size" => "large",
  162. "type" => "primary",
  163. "htmlOptions" => array(
  164. "onclick" => "$('.crud-form form').submit();",
  165. ),
  166. "visible" => $showSaveButton && (Yii::app()->user->checkAccess(
  167. "P3media.P3MediaTranslation.*"
  168. ) || Yii::app()->user->checkAccess("P3media.P3MediaTranslation.View"))
  169. )
  170. );
  171. ?> </div>
  172. <?php if ($this->action->id == 'admin'): ?>
  173. <div class="btn-group">
  174. <?php
  175. $this->widget(
  176. "bootstrap.widgets.TbButton",
  177. array(
  178. #"label"=>Yii::t("P3MediaModule.crud","Search"),
  179. "icon" => "icon-search",
  180. "size" => "large",
  181. "htmlOptions" => array(
  182. "class" => "search-button",
  183. "data-toggle" => "tooltip",
  184. "title" => Yii::t("P3MediaModule.crud", "Advanced Search"),
  185. )
  186. )
  187. );
  188. ?>
  189. <?php
  190. $this->widget(
  191. "bootstrap.widgets.TbButton",
  192. array(
  193. #"label"=>Yii::t("P3MediaModule.crud","Clear"),
  194. "icon" => "icon-remove-sign",
  195. "size" => "large",
  196. "url" => Yii::app()->baseURL . "/" . Yii::app()->request->getPathInfo(),
  197. "htmlOptions" => array(
  198. "data-toggle" => "tooltip",
  199. "title" => Yii::t("P3MediaModule.crud", "Clear Search"),
  200. )
  201. )
  202. );
  203. ?>
  204. </div>
  205. <?php endif; ?>
  206. </div>
  207. </div>
  208. <?php if ($this->action->id == 'admin'): ?>
  209. <div class="search-form" style="display:none">
  210. <?php Yii::beginProfile('P3MediaTranslation.view.toolbar.search'); ?> <?php $this->renderPartial(
  211. '_search',
  212. array('model' => $model,)
  213. ); ?>
  214. <?php Yii::endProfile('P3MediaTranslation.view.toolbar.search'); ?></div>
  215. <?php endif; ?>
  216. <?php Yii::endProfile('P3MediaTranslation.view.toolbar'); ?>