예제 #1
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new DocChild('search');
     $name = "Docs";
     $attachments = new CActiveDataProvider('Media', array('criteria' => array('order' => 'createDate DESC', 'condition' => 'associationType="docs"')));
     $pageParam = ucfirst($this->modelClass) . '_page';
     if (isset($_GET[$pageParam])) {
         $page = $_GET[$pageParam];
         Yii::app()->user->setState($this->id . '-page', (int) $page);
     } else {
         $page = Yii::app()->user->getState($this->id . '-page', 1);
         $_GET[$pageParam] = $page;
     }
     if (intval(Yii::app()->request->getParam('clearFilters')) == 1) {
         EButtonColumnWithClearFilters::clearFilters($this, $model);
         //where $this is the controller
     }
     $this->render('admin', array('model' => $model, 'attachments' => $attachments));
 }
예제 #2
0
파일: x2base.php 프로젝트: ruchida/X2Engine
	/**
	 * Manages all models.
	 * @param $model The model to use admin on, created in a controller subclass.  The model must be constucted with the parameter 'search'
	 * @param $name The name of the model being viewed (Sales, Actions, etc.)
	 */
	public function actionAdmin($model, $name) {

		$pageParam = ucfirst($this->modelClass). '_page';
		if (isset($_GET[$pageParam])) {
			$page = $_GET[$pageParam];
			Yii::app()->user->setState($this->id.'-page',(int)$page);
		} else {
			$page=Yii::app()->user->getState($this->id.'-page',1);
			$_GET[$pageParam] = $page;
		}
		if (intval(Yii::app()->request->getParam('clearFilters'))==1) {
			EButtonColumnWithClearFilters::clearFilters($this,$model);//where $this is the controller
		}
		$this->render('admin',array(
			'model'=>$model,
		));
	}
예제 #3
0
">Edit</a></h2>

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'accounts-form', 'enableAjaxValidation' => false, 'action' => array('saveChanges', 'id' => $model->id)));
$this->renderPartial('application.components.views._detailView', array('model' => $model, 'form' => $form, 'modelName' => 'accounts'));
$this->endWidget();
?>


<div id="attachment-form" style="display:none;">
	<?php 
$this->widget('Attachments', array('type' => 'accounts', 'associationId' => $model->id));
?>
</div>
<?php 
$contactModel = new Contacts('search');
if (intval(Yii::app()->request->getParam('clearFilters')) == 1) {
    EButtonColumnWithClearFilters::clearFilters($this, $contactModel);
    //where $this is the controller
}
$this->widget('application.components.X2GridView', array('id' => 'associated-contacts-grid', 'baseScriptUrl' => Yii::app()->request->baseUrl . '/themes/' . Yii::app()->theme->name . '/css/gridview', 'template' => '<h2>' . Yii::t('contacts', 'Associated Contacts') . '</h2><div class="title-bar">' . CHtml::link(Yii::t('app', 'Clear Filters'), array($model->id, 'clearFilters' => 1)) . ' | ' . CHtml::link(Yii::t('app', 'Columns'), 'javascript:void(0);', array('class' => 'column-selector-link')) . '{summary}</div>{items}{pager}', 'dataProvider' => $contactModel->searchAccount($model->id), 'filter' => $contactModel, 'modelName' => 'Contacts', 'viewName' => 'contacts', 'defaultGvSettings' => array('name' => 234, 'email' => 108, 'leadsource' => 128, 'assignedTo' => 115), 'specialColumns' => array('name' => array('name' => 'name', 'header' => Yii::t('contacts', 'Name'), 'value' => 'CHtml::link($data->name,array("/contacts/".$data->id))', 'type' => 'raw')), 'enableControls' => true));
?>
<br>
<?php 
$this->widget('InlineActionForm', array('associationType' => 'accounts', 'associationId' => $model->id, 'assignedTo' => Yii::app()->user->getName(), 'users' => $users, 'startHidden' => false));
if (isset($_GET['history'])) {
    $history = $_GET['history'];
} else {
    $history = "all";
}
$this->widget('zii.widgets.CListView', array('dataProvider' => $actionHistory, 'itemView' => 'application.modules.actions.views.default._view', 'htmlOptions' => array('class' => 'action list-view'), 'template' => ($history == 'all' ? '<h3>' . Yii::t('app', 'History') . "</h3>" : CHtml::link(Yii::t('app', 'History'), "?history=all")) . " | " . ($history == 'actions' ? '<h3>' . Yii::t('app', 'Actions') . "</h3>" : CHtml::link(Yii::t('app', 'Actions'), "?history=actions")) . " | " . ($history == 'comments' ? '<h3>' . Yii::t('app', 'Comments') . "</h3>" : CHtml::link(Yii::t('app', 'Comments'), "?history=comments")) . " | " . ($history == 'attachments' ? '<h3>' . Yii::t('app', 'Attachments') . "</h3>" : CHtml::link(Yii::t('app', 'Attachments'), "?history=attachments")) . '</h3>{summary}{sorter}{items}{pager}'));
 public static function clearFilters($controller, $model)
 {
     $model->unsetAttributes();
     try {
         if (EButtonColumnWithClearFilters::modelUsesBehavior($model, 'ERememberFiltersBehavior')) {
             $model->unsetFilters();
         }
     } catch (Exception $e) {
     }
     $controller->redirect(array($controller->action->ID));
 }
 public static function clearFilters($controller, $model)
 {
     $model->unsetAttributes();
     if (EButtonColumnWithClearFilters::modelUsesBehavior($model, 'ERememberFiltersBehavior')) {
         try {
             $model->unsetFilters();
         } catch (Exception $e) {
         }
     }
     if (isset($_GET['id'])) {
         $controller->redirect(array($controller->action->ID, 'id' => Yii::app()->request->getParam('id')));
     } else {
         $controller->redirect(array($controller->action->ID));
     }
 }
예제 #6
0
 public function actionViewChangelog()
 {
     $model = new Changelog('search');
     $model->timestamp = null;
     $pageParam = ucfirst('Changelog') . '_page';
     if (isset($_GET[$pageParam])) {
         $page = $_GET[$pageParam];
         Yii::app()->user->setState($this->id . '-page', (int) $page);
     } else {
         $page = Yii::app()->user->getState($this->id . '-page', 1);
         $_GET[$pageParam] = $page;
     }
     if (intval(Yii::app()->request->getParam('clearFilters')) == 1) {
         EButtonColumnWithClearFilters::clearFilters($this, $model);
         //where $this is the controller
     }
     $this->render('viewChangelog', array('model' => $model));
 }
예제 #7
0
 public function actionAdmin()
 {
     Yii::import("vendor.pentium10.yii-clear-filters-gridview.components.*");
     $model = new EcerErrors('search');
     if (intval(Yii::app()->request->getParam('clearFilters')) == 1) {
         EButtonColumnWithClearFilters::clearFilters($this, $model);
         //where $this is the controller
     }
     $scopes = $model->scopes();
     if (isset($scopes[$this->scope])) {
         $model->{$this->scope}();
     }
     $model->unsetAttributes();
     if (isset($_GET['EcerErrors'])) {
         $model->attributes = $_GET['EcerErrors'];
         $this->renderPartial('admin', array('model' => $model));
     } else {
         $this->render('admin', array('model' => $model));
     }
 }