コード例 #1
0
 /**
  * Sets objects of related model
  * 
  * @param Uni_Core_Model $model
  * @return void
  */
 public function setModel($model)
 {
     $this->model = $model;
     $eleKeys = array();
     $subForms = $this->getSubForms();
     foreach ($subForms as $subForm) {
         $eleKeys = array_merge($eleKeys, array_keys($subForm->getElements()));
     }
     $data = $this->model->getData($eleKeys);
     $this->setFormData($data);
 }
コード例 #2
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     /**
      * Table name
      */
     $this->_name = 'cms_block';
     parent::__construct();
 }
コード例 #3
0
 /**
  * Constructs object of model using optional configuration
  * supplied by $config param
  *
  * @param array $config 
  */
 public function __construct($config = array())
 {
     $this->setStatus(Fox_Extensionmanager_Model_Package_Status::DEFAULT_STATUS);
     $conf = Fox::getModel('extensionmanager/config');
     if ($conf->hasErrors()) {
         $this->errors = $this->errors + $conf->getErrors();
     }
     $this->setConfig($conf);
     parent::__construct($config);
 }
コード例 #4
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     /**
      * Table name
      */
     $this->_name = 'member_verification_entity';
     /**
      * Table primary key field
      */
     $this->primary = 'id';
     parent::__construct();
 }
コード例 #5
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     /**
      * Table name
      */
     $this->_name = 'core_email_template';
     /**
      * Table primary key field
      */
     $this->primary = 'id';
     parent::__construct();
 }
コード例 #6
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     /**
      * Table name
      */
     $this->_name = 'backup_report';
     /**
      * Table primary key field
      */
     $this->primary = 'id';
     parent::__construct();
 }
コード例 #7
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     /**
      * Table name
      */
     $this->_name = 'admin_role_resource_category';
     /**
      * Table primary key field
      */
     $this->primary = 'id';
     parent::__construct();
 }
コード例 #8
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     /**
      * Table name
      */
     $this->_name = 'core_preferences';
     /**
      * Table primary key field
      */
     $this->primary = 'id';
     parent::__construct();
 }
コード例 #9
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     /**
      * Table name
      */
     $this->_name = 'core_cache';
     /**
      * Table primary key field
      */
     $this->primary = 'cache_code';
     parent::__construct();
 }
コード例 #10
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     /**
      * Table name
      */
     $this->_name = 'admin_user';
     /**
      * Table primary key field
      */
     $this->primary = 'id';
     parent::__construct();
 }
コード例 #11
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     /**
      * Table name
      */
     $this->_name = 'navigation_menu_item';
     /**
      * Table primary key field
      */
     $this->primary = 'id';
     parent::__construct();
 }
コード例 #12
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     /**
      * Table name
      */
     $this->_name = 'contact_request';
     /**
      * Table primary key field 
      */
     $this->primary = 'id';
     parent::__construct();
 }
コード例 #13
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     /**
      * Table name
      */
     $this->_name = 'member_forget_password_entity';
     /**
      * Table primary key field
      */
     $this->primary = 'id';
     parent::__construct();
 }
コード例 #14
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     /**
      * Table name
      */
     $this->_name = 'newsletter_subscriber';
     /**
      * Table primary key field
      */
     $this->primary = 'id';
     parent::__construct();
 }
コード例 #15
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     /**
      * Table name
      */
     $this->_name = 'eav_entity_type';
     /**
      * Table primary key field 
      */
     $this->primary = 'id';
     parent::__construct();
 }
コード例 #16
0
 /**
  * Public constructor
  */
 public function __construct()
 {
     /**
      * Table name
      */
     $this->_name = 'eav_attribute_set';
     /**
      * Table primary key field
      */
     $this->primary = 'id';
     parent::__construct();
 }
コード例 #17
0
 /**
  * Fetches the group action values
  * 
  * @param Uni_Core_Model $model Object of Model to which the group action applies
  * @param string $loadField [Optional]<p>Primary Key field of the Model</p>
  * @return mixed Array|NULL
  * @throws Exception if Model Object is NULL 
  */
 protected function getGroupActionIds(Uni_Core_Model $model, $loadField = NULL)
 {
     $condition = '';
     $selectType = $this->getRequest()->getParam('selected', NULL);
     $ids = $this->getRequest()->getParam('extra', NULL);
     $filters = $this->getRequest()->getParam('filters', FALSE);
     $columns = $this->getRequest()->getParam('colTypes', FALSE);
     if (!isset($selectType) || !isset($ids)) {
         throw new Exception('Unsufficient Parameters sent. Unable to perform group action');
     }
     if (!$model) {
         throw new Exception('Invalid model object was given');
     }
     if ($selectType > 0) {
         $loadField = $loadField != NULL ? $loadField : $model->getPrimaryField();
         if ($columns) {
             if (get_magic_quotes_gpc()) {
                 $columns = Zend_Json_Decoder::decode(stripslashes($columns));
             } else {
                 $columns = Zend_Json_Decoder::decode($columns);
             }
         }
         if (!empty($filters)) {
             foreach ($filters as $key => $value) {
                 if (is_array($value)) {
                     if (isset($value['from']) && $value['from']) {
                         $condition .= ($condition ? ' AND ' : '') . "{$key}>='" . $value['from'] . "'";
                     }
                     if (isset($value['to']) && $value['to']) {
                         $condition .= ($condition ? ' AND ' : '') . "{$key}<='" . $value['to'] . "'";
                     }
                 } else {
                     if (isset($columns) && isset($columns[$key]) && $columns[$key] == Fox_Core_View_Admin_Table::TYPE_OPTIONS) {
                         $condition .= ($condition ? ' AND ' : '') . "{$key} = '{$value}'";
                     } else {
                         $condition .= ($condition ? ' AND ' : '') . "{$key} LIKE '%{$value}%'";
                     }
                 }
             }
         }
         if (!empty($ids)) {
             $condition .= ($condition ? ' AND ' : '') . $loadField . ' NOT IN(\'' . implode('\',\'', $ids) . '\')';
         }
         $ids = array();
         $collection = $model->getCollection($condition, array($loadField));
         foreach ($collection as $row) {
             $ids[] = $row[$loadField];
         }
     }
     return $ids;
 }
コード例 #18
0
 /**
  * Gets value of field on which the group action is to be performed
  *
  * @param Uni_Core_Model $item
  * @return string
  */
 public function getGroupActionValue($item)
 {
     if (isset($this->groupActionField)) {
         $method = 'get' . ucfirst(Uni_Core_Model::getPropertyName($this->groupActionField));
         $value = $item->{$method};
     } else {
         $value = $item->getId();
     }
     return $value;
 }
コード例 #19
0
 /**
  * Process data before save
  * 
  * @param array $data
  * @return array 
  * @throws Exception if uploads directory not found
  */
 protected function _preSave(array $data)
 {
     if (!empty($_FILES)) {
         $path = Fox::getUploadDirectoryPath() . DIRECTORY_SEPARATOR . $this->_eav_entity_type;
         if (!file_exists($path)) {
             if (!@mkdir($path, 777, TRUE)) {
                 throw new Exception('uploads directory was not found.');
             }
         }
         foreach ($_FILES as $key => $file) {
             if (isset($file['tmp_name']) && $file['tmp_name']) {
                 if (($pos = strrpos($file['name'], '.')) > -1) {
                     $ext = substr($file['name'], $pos + 1);
                     $fileName = 'FILE-' . time() . '.' . $ext;
                     $filePath = $path . DIRECTORY_SEPARATOR;
                     $upload = new Zend_File_Transfer_Adapter_Http();
                     $upload->setDestination($filePath);
                     $upload->receive($key);
                     $uploadedfilepath = $upload->getFileName($key);
                     $filterFileRename = new Zend_Filter_File_Rename(array('target' => $filePath . $fileName, 'overwrite' => true));
                     $filterFileRename->filter($uploadedfilepath);
                     $method = Uni_Core_Model::SET . Fox::getCamelCase($key);
                     $this->{$method}($fileName);
                 }
             }
         }
     }
     return parent::_preSave($data);
 }