/**
  *
  * @param string $fileName Name fe the file
  * @param string $encoding An encoding to use
  */
 public function __construct($fileName, $encoding = null)
 {
     parent::__construct($fileName);
     $this->_fileName = $fileName;
     if ($encoding && $encoding !== mb_internal_encoding()) {
         $this->_encoding = $encoding;
     }
 }
 protected function _load(array $filter, array $sort)
 {
     $data = parent::_load($filter, $sort);
     if ($filter && count($data) == 1) {
         $template = reset($data);
         // Loaded one item, now set this to be the current template
         $this->setTemplate($template['name'], $template['path'], $data);
     }
     return $data;
 }
Exemple #3
0
 /**
  *
  * @param string $fileName
  */
 public function __construct($fileName, $xpath = '/*')
 {
     parent::__construct($fileName);
     $this->_fileName = $fileName;
     $this->_xml = \MUtil_XmlRa::loadFile($fileName, $xpath);
     foreach ($this->_loadAllTraversable() as $row) {
         if (is_array($row)) {
             $this->setMulti(array_keys($row));
         }
     }
 }
 /**
  *
  * Save using a string as content, the first line contains the header for the field
  * order in the rest of the data.
  *
  * @param string $modelName Hopefully unique model name
  * @param array|string $content Either a nested array containing the data or a string to split
  * @param array|string $fieldSplit Either an array containing header field names for the content
  *                                 or a string split string.
  * @param string $lineSplit
  */
 public function __construct($modelName, $content = array(), $fieldSplit = "\t", $lineSplit = "\n")
 {
     parent::__construct($modelName);
     if (is_array($content)) {
         if (is_array($fieldSplit)) {
             $this->saveIndexed($content, $fieldSplit);
         } else {
             $this->_saveAllTraversable($content);
         }
     } else {
         $this->saveHeadedString($content, $fieldSplit, $lineSplit);
     }
 }
Exemple #5
0
 /**
  *
  * @param string $dir
  * @param string $pregMask An optional regex file mask, use of / for directory seperator required
  * @param boolean $recursive When true the directory is searched recursively
  */
 public function __construct($dir, $mask = null, $recursive = false)
 {
     parent::__construct($dir);
     $this->dir = $dir;
     $this->mask = $mask;
     $this->recursive = $recursive;
     $this->set('fullpath', 'type', \MUtil_Model::TYPE_STRING);
     $this->set('path', 'type', \MUtil_Model::TYPE_STRING);
     $this->set('filename', 'type', \MUtil_Model::TYPE_STRING);
     $this->set('relpath', 'type', \MUtil_Model::TYPE_STRING);
     $this->set('urlpath', 'type', \MUtil_Model::TYPE_STRING);
     $this->set('extension', 'type', \MUtil_Model::TYPE_STRING);
     $this->set('content', 'type', \MUtil_Model::TYPE_STRING);
     $this->set('size', 'type', \MUtil_Model::TYPE_NUMERIC);
     $this->set('changed', 'type', \MUtil_Model::TYPE_DATETIME);
     $this->setKeys(array('urlpath'));
 }
 /**
  *
  * @param \Zend_Db_Adapter_Abstract $db
  * @param array $directories directory => name | \Zend_Db_Adaptor_Abstract | array(['path' =>], 'name' =>, 'db' =>,)
  */
 public function __construct(\Zend_Db_Adapter_Abstract $db, array $directories)
 {
     parent::__construct('DbaModel');
     $this->defaultDb = $db;
     $this->directories = $directories;
     //Grab translate object from the Escort
     $this->translate = \GemsEscort::getInstance()->translate;
     $this->set('group', 'maxlength', 40, 'type', \MUtil_Model::TYPE_STRING);
     $this->set('name', 'key', true, 'maxlength', 40, 'type', \MUtil_Model::TYPE_STRING);
     $this->set('type', 'maxlength', 40, 'type', \MUtil_Model::TYPE_STRING);
     $this->set('order', 'decimals', 0, 'default', self::DEFAULT_ORDER, 'maxlength', 6, 'type', \MUtil_Model::TYPE_NUMERIC);
     $this->set('defined', 'type', \MUtil_Model::TYPE_NUMERIC);
     $this->set('exists', 'type', \MUtil_Model::TYPE_NUMERIC);
     $this->set('state', 'type', \MUtil_Model::TYPE_NUMERIC);
     $this->set('path', 'maxlength', 255, 'type', \MUtil_Model::TYPE_STRING);
     $this->set('fullPath', 'maxlength', 255, 'type', \MUtil_Model::TYPE_STRING);
     $this->set('fileName', 'maxlength', 100, 'type', \MUtil_Model::TYPE_STRING);
     $this->set('script', 'type', \MUtil_Model::TYPE_STRING);
     $this->set('lastChanged', 'type', \MUtil_Model::TYPE_DATETIME);
     $this->set('location', 'maxlength', 12, 'type', \MUtil_Model::TYPE_STRING);
     $this->set('state', 'multiOptions', array(\Gems_Model_DbaModel::STATE_CREATED => $this->_('created'), \Gems_Model_DbaModel::STATE_DEFINED => $this->_('not created'), \Gems_Model_DbaModel::STATE_UNKNOWN => $this->_('unknown')));
 }
 public function __construct($modelName, $fieldArray, $data = array())
 {
     parent::__construct($modelName);
     $this->data = $data;
     $this->setMulti($fieldArray);
 }
 /**
  *
  * @return boolean
  */
 public function accept()
 {
     return $this->_model->applyFiltersToRow($this->current(), $this->_filter);
 }
Exemple #9
0
 /**
  *
  * @param string $modelName Hopefully unique model name
  */
 public function __construct($modelName)
 {
     parent::__construct($modelName);
     $this->_session = new \Zend_Session_Namespace(__CLASS__ . '::' . $modelName);
     $this->_session->data = array();
 }
Exemple #10
0
 /**
  *
  * @param string $fileName Name fe the file
  * @param string $encoding An encoding to use
  */
 public function __construct($fileName, $encoding = null)
 {
     parent::__construct($fileName);
     $this->_fileName = $fileName;
     $this->_encoding = $encoding;
 }