示例#1
0
 public function __construct(Am_Request $request, Am_View $view)
 {
     $id = explode('_', get_class($this));
     $id = strtolower(array_pop($id));
     parent::__construct('_' . $id, ___(ucfirst($id)), $this->createAdapter(), $request, $view);
     $this->addCallback(self::CB_AFTER_INSERT, array($this, 'afterInsert'));
     $this->addCallback(self::CB_AFTER_UPDATE, array($this, 'afterInsert'));
     $this->addCallback(self::CB_VALUES_TO_FORM, array($this, '_valuesToForm'));
     foreach ($this->getActions() as $action) {
         $action->setTarget('_top');
     }
 }
示例#2
0
文件: Content.php 项目: grlf/eyedock
 public function __construct(Am_Request $request, Am_View $view)
 {
     //Am_Db::setLogger();
     $adapter = $this->joinSort($this->createAdapter());
     parent::__construct('_' . $this->getContentGridId(), $this->getTitle(), $adapter, $request, $view);
     $this->setEventId('gridContent' . ucfirst($this->getContentGridId()));
     $this->addCallback(self::CB_AFTER_INSERT, array($this, 'afterInsert'));
     $this->addCallback(self::CB_AFTER_UPDATE, array($this, 'afterInsert'));
     $this->addCallback(self::CB_VALUES_TO_FORM, array($this, '_valuesToForm'));
     foreach ($this->getActions() as $action) {
         $action->setTarget('_top');
     }
 }
示例#3
0
 function __construct($id, $title, \Am_Grid_DataSource_Interface_Editable $ds, \Am_Request $request, \Am_View $view, \Am_Di $di = null)
 {
     parent::__construct($id, $title, $ds, $request, $view, $di);
     $this->_request = $request;
 }
 public function __construct(Am_Request $request, Am_View $view)
 {
     $id = explode('_', get_class($this));
     $id = strtolower(array_pop($id));
     parent::__construct('_' . $id, $this->getGridTitle(), $this->createDs(), $request, $view);
 }
 public function __construct(Am_Request $request, Am_View $view)
 {
     $di = Am_Di::getInstance();
     $ds = null;
     $i = 0;
     $key = null;
     foreach ($di->resourceAccessTable->getAccessTables() as $k => $t) {
         $q = new Am_Query($t);
         $q->clearFields();
         if (empty($key)) {
             $key = $t->getKeyField();
         }
         $q->addField($t->getKeyField(), $key);
         $type = $t->getAccessType();
         $q->addField("'{$type}'", 'resource_type');
         $q->addField($t->getTitleField(), 'title');
         $q->addField($q->escape($t->getAccessTitle()), 'type_title');
         $q->addField($q->escape($t->getPageId()), 'page_id');
         if ($t instanceof EmailTemplateTable) {
             $q->addWhere('name IN (?a)', array(EmailTemplate::AUTORESPONDER, EmailTemplate::EXPIRE));
         }
         if (empty($ds)) {
             $ds = $q;
         } else {
             $ds->addUnion($q);
         }
     }
     // yes we need that subquery in subquery to mask field names
     // to get access of fields of main query (!)
     $ds->addOrderRaw("(SELECT _sort_order\n             FROM ( SELECT sort_order as _sort_order,\n                    resource_type as _resource_type,\n                    resource_id as _resource_id\n                  FROM ?_resource_access_sort ras) AS _ras\n             WHERE _resource_id={$key} AND _resource_type=resource_type LIMIT 1),\n             {$key}, resource_type");
     parent::__construct('_all', ___('All Content'), $ds, $request, $view, $di);
     $this->addField('type_title', ___('Type'));
     $this->addField('title', ___('Title'));
     if ($this->getDi()->db->selectCell("SELECT COUNT(*) FROM ?_resource_resource_category")) {
         $this->addField(new Am_Grid_Field('rgroup', ___('Categories'), false))->setRenderFunction(array($this, 'renderCategory'));
     }
     $this->actionDelete('insert');
     $this->actionDelete('edit');
     $this->actionDelete('delete');
     $this->actionAdd(new Am_Grid_Action_ContentAllEdit('edit', ___('Edit'), ''));
     $this->actionAdd(new Am_Grid_Action_SortContent());
 }
 public function __construct(Am_Request $request, Am_View $view)
 {
     parent::__construct('_affcommconf', ___('Affiliate Commission Rules'), Am_Di::getInstance()->affCommissionRuleTable->createQuery(), $request, $view);
     $this->setRecordTitle('Commission Rule');
     $this->addField('comment', 'Comment')->setRenderFunction(array($this, 'renderComment'));
     $this->addField('sort_order', 'Sort')->setRenderFunction(array($this, 'renderSort'));
     $this->addField('_commission', 'Commission', false)->setRenderFunction(array($this, 'renderCommission'));
     $this->addField('_conditions', 'Conditions', false)->setRenderFunction(array($this, 'renderConditions'));
     $this->actionGet('edit')->setTarget('_top');
     $this->actionGet('insert')->setTitle('New Custom %s')->setTarget('_top');
     $this->actionAdd(new Am_Grid_Action_AddTier());
     if ($this->getDi()->affCommissionRuleTable->getMaxTier()) {
         $this->actionAdd(new Am_Grid_Action_RemoveLastTier());
     }
     $this->actionAdd(new Am_Grid_Action_TestAffCommissionRule());
     $this->setForm(array($this, 'createConfigForm'));
     $this->addCallback(Am_Grid_Editable::CB_VALUES_TO_FORM, array($this, '_valuesToForm'));
     $this->addCallback(Am_Grid_Editable::CB_VALUES_FROM_FORM, array($this, '_valuesFromForm'));
 }
示例#7
0
 function __construct($id, $title, Am_Grid_DataSource_Interface_Editable $ds, Am_Request $request, Am_View $view, Am_Di $di = null, User $reseller)
 {
     parent::__construct($id, $title, $ds, $request, $view, $di);
     $this->reseller = $reseller;
 }