/views/p3MediaTranslation/_toolbar.php
https://github.com/schmunk42/p3media · PHP · 226 lines · 210 code · 10 blank · 6 comment · 19 complexity · c8297cb159fb20ce264d36c25205dc31 MD5 · raw file
- <?php Yii::beginProfile('P3MediaTranslation.view.toolbar'); ?>
- <?php
- $showDeleteButton = (Yii::app()->request->getParam("id")) ? true : false;
- $showManageButton = true;
- $showCreateButton = true;
- $showUpdateButton = true;
- $showCancelButton = true;
- $showSaveButton = true;
- $showViewButton = true;
- switch ($this->action->id) {
- case "admin":
- $showCancelButton = false;
- $showSaveButton = false;
- $showViewButton = false;
- $showUpdateButton = false;
- break;
- case "update":
- $showCreateButton = false;
- $showUpdateButton = false;
- break;
- case "create":
- $showCreateButton = false;
- $showViewButton = false;
- $showUpdateButton = false;
- break;
- case "view":
- $showViewButton = false;
- $showSaveButton = false;
- $showCreateButton = false;
- break;
- }
- ?>
- <div class="clearfix">
- <div class="btn-toolbar pull-right">
- <!-- relations -->
- <div class="btn-group">
- <?php $this->widget(
- 'bootstrap.widgets.TbButtonGroup',
- array(
- 'size' => 'large',
- 'buttons' => array(
- array(
- #'label'=>Yii::t('P3MediaModule.crud','Relations'),
- 'icon' => 'icon-random',
- 'items' => array(
- array(
- 'icon' => 'circle-arrow-left',
- 'label' => Yii::t('p3MediaModule.model', 'relation.P3Media'),
- 'url' => array('/p3media/p3Media/admin')
- ),
- )
- ),
- ),
- )
- );
- ?> </div>
- <div class="btn-group">
- <?php
- $this->widget(
- "bootstrap.widgets.TbButton",
- array(
- "label" => Yii::t("P3MediaModule.crud", "Manage"),
- "icon" => "icon-list-alt",
- "size" => "large",
- "url" => array("admin"),
- "visible" => $showManageButton && (Yii::app()->user->checkAccess(
- "P3media.P3MediaTranslation.*"
- ) || Yii::app()->user->checkAccess("P3media.P3MediaTranslation.View"))
- )
- );
- ?> </div>
- </div>
- <div class="btn-toolbar pull-left">
- <div class="btn-group">
- <?php
- $this->widget(
- "bootstrap.widgets.TbButton",
- array(
- #"label"=>Yii::t("P3MediaModule.crud","Cancel"),
- "icon" => "chevron-left",
- "size" => "large",
- "url" => (isset($_GET["returnUrl"])) ? $_GET["returnUrl"] : array("{$this->id}/admin"),
- "visible" => $showCancelButton && (Yii::app()->user->checkAccess(
- "P3media.P3MediaTranslation.*"
- ) || Yii::app()->user->checkAccess("P3media.P3MediaTranslation.View")),
- "htmlOptions" => array(
- "class" => "search-button",
- "data-toggle" => "tooltip",
- "title" => Yii::t("P3MediaModule.crud", "Cancel"),
- )
- )
- );
- $this->widget(
- "bootstrap.widgets.TbButton",
- array(
- "label" => Yii::t("P3MediaModule.crud", "Create"),
- "icon" => "icon-plus",
- "size" => "large",
- "type" => "success",
- "url" => array("create"),
- "visible" => $showCreateButton && (Yii::app()->user->checkAccess(
- "P3media.P3MediaTranslation.*"
- ) || Yii::app()->user->checkAccess("P3media.P3MediaTranslation.Create"))
- )
- );
- $this->widget(
- "bootstrap.widgets.TbButton",
- array(
- "label" => Yii::t("P3MediaModule.crud", "Delete"),
- "type" => "danger",
- "icon" => "icon-trash icon-white",
- "size" => "large",
- "htmlOptions" => array(
- "submit" => array(
- "delete",
- "id" => $model->{$model->tableSchema->primaryKey},
- "returnUrl" => (Yii::app()->request->getParam("returnUrl")) ? Yii::app(
- )->request->getParam("returnUrl") : $this->createUrl("admin")
- ),
- "confirm" => Yii::t("P3MediaModule.crud", "Do you want to delete this item?")
- ),
- "visible" => $showDeleteButton && (Yii::app()->user->checkAccess(
- "P3media.P3MediaTranslation.*"
- ) || Yii::app()->user->checkAccess("P3media.P3MediaTranslation.Delete"))
- )
- );
- $this->widget(
- "bootstrap.widgets.TbButton",
- array(
- #"label"=>Yii::t("P3MediaModule.crud","Update"),
- "icon" => "icon-edit",
- "type" => "primary",
- "size" => "large",
- "url" => array("update", "id" => $model->{$model->tableSchema->primaryKey}),
- "visible" => $showUpdateButton && (Yii::app()->user->checkAccess(
- "P3media.P3MediaTranslation.*"
- ) || Yii::app()->user->checkAccess("P3media.P3MediaTranslation.Update"))
- )
- );
- $this->widget(
- "bootstrap.widgets.TbButton",
- array(
- #"label"=>Yii::t("P3MediaModule.crud","View"),
- "icon" => "icon-eye-open",
- "size" => "large",
- "url" => array("view", "id" => $model->{$model->tableSchema->primaryKey}),
- "visible" => $showViewButton && (Yii::app()->user->checkAccess(
- "P3media.P3MediaTranslation.*"
- ) || Yii::app()->user->checkAccess("P3media.P3MediaTranslation.View")),
- "htmlOptions" => array(
- "data-toggle" => "tooltip",
- "title" => Yii::t("P3MediaModule.crud", "View Mode"),
- )
- )
- );
- $this->widget(
- "bootstrap.widgets.TbButton",
- array(
- "label" => Yii::t("P3MediaModule.crud", "Save"),
- "icon" => "save",
- "size" => "large",
- "type" => "primary",
- "htmlOptions" => array(
- "onclick" => "$('.crud-form form').submit();",
- ),
- "visible" => $showSaveButton && (Yii::app()->user->checkAccess(
- "P3media.P3MediaTranslation.*"
- ) || Yii::app()->user->checkAccess("P3media.P3MediaTranslation.View"))
- )
- );
- ?> </div>
- <?php if ($this->action->id == 'admin'): ?>
- <div class="btn-group">
- <?php
- $this->widget(
- "bootstrap.widgets.TbButton",
- array(
- #"label"=>Yii::t("P3MediaModule.crud","Search"),
- "icon" => "icon-search",
- "size" => "large",
- "htmlOptions" => array(
- "class" => "search-button",
- "data-toggle" => "tooltip",
- "title" => Yii::t("P3MediaModule.crud", "Advanced Search"),
- )
- )
- );
- ?>
- <?php
- $this->widget(
- "bootstrap.widgets.TbButton",
- array(
- #"label"=>Yii::t("P3MediaModule.crud","Clear"),
- "icon" => "icon-remove-sign",
- "size" => "large",
- "url" => Yii::app()->baseURL . "/" . Yii::app()->request->getPathInfo(),
- "htmlOptions" => array(
- "data-toggle" => "tooltip",
- "title" => Yii::t("P3MediaModule.crud", "Clear Search"),
- )
- )
- );
- ?>
- </div>
- <?php endif; ?>
- </div>
- </div>
- <?php if ($this->action->id == 'admin'): ?>
- <div class="search-form" style="display:none">
- <?php Yii::beginProfile('P3MediaTranslation.view.toolbar.search'); ?> <?php $this->renderPartial(
- '_search',
- array('model' => $model,)
- ); ?>
- <?php Yii::endProfile('P3MediaTranslation.view.toolbar.search'); ?></div>
- <?php endif; ?>
- <?php Yii::endProfile('P3MediaTranslation.view.toolbar'); ?>