コード例 #1
0
ファイル: Gallery.php プロジェクト: samsonos/php_parse
 /**
  * Constructor
  *
  * @param integer  $idx         Column index for parsing
  * @param Material $material    Pointer to parent material parser
  * @param callable $parser      External parser routine
  * @param string   $token       Token for getting multiple images from column
  * @param string   $uploadPath  Path to current image location and storing
  */
 public function __construct($idx, Material &$material, $parser = null, $token = ',', $uploadPath = 'cms/upload/')
 {
     // Save connection to material
     $this->material =& $material;
     $this->token = $token;
     $this->uploadPath = $uploadPath;
     // Call parent
     parent::__construct($idx, $parser);
 }
コード例 #2
0
ファイル: Material.php プロジェクト: samsonos/php_parse
 public function __construct($idx, $parser = null, $successHandler = null, $allowEmptyValues = false, array $uniqueArray = array(), array $findByField = array())
 {
     parent::__construct($idx, $parser, $successHandler, $allowEmptyValues);
     if (empty($uniqueArray)) {
         $this->uniqueArray = dbQuery('material')->fields('Name');
     } else {
         $this->uniqueArray = $uniqueArray;
     }
     $this->findByField = $findByField;
 }
コード例 #3
0
ファイル: MaterialField.php プロジェクト: samsonos/php_parse
 /** Override generic column parser initialization */
 public function init()
 {
     // This is very important
     if (!isset($this->name[0])) {
         return e('Cannot create MaterialField - no name is passed', E_SAMSON_FATAL_ERROR);
     }
     // Try to find field record
     if (!SamsonCMS::find('field', $this->name, $this->db_field)) {
         // Create new field record
         $this->db_field = new \samson\activerecord\field(false);
         $this->db_field->Name = $this->name;
         $this->db_field->Active = 1;
         $this->db_field->Description = $this->description;
         $this->db_field->Value = $this->defaultValue;
         $this->db_field->Type = $this->type;
         // Set field localization if necessary
         if (isset($this->locale)) {
             $this->db_field->local = 1;
         }
         $this->db_field->save();
     }
     // Try to find structure
     if (SamsonCMS::find('structure', $this->parentStructure, $this->parentStructure)) {
         // Is this field is not connect with this structure already
         $fields = null;
         if (!dbQuery('structurefield')->StructureID($this->parentStructure->StructureID)->FieldID($this->db_field->id)->exec($fields)) {
             // Connect material field to structure
             $sf = new \samson\activerecord\structurefield(false);
             $sf->StructureID = $this->parentStructure->StructureID;
             $sf->FieldID = $this->db_field->id;
             $sf->Active = 1;
             $sf->save();
         }
     }
     parent::init();
 }