Exemplo n.º 1
0
 /** @inheritdoc */
 public function render(RenderInterface $renderer, QueryInterface $query, $object)
 {
     // Get all available groups from db
     $groupSelect = array();
     foreach ($query->className('group')->cond('Active', 1)->exec() as $group) {
         $groupSelect[] = $group->GroupID . ':' . $group->Name;
     }
     // Set view
     return $renderer->view($this->innerView)->set('class', $this->css)->set($object, 'item')->set(m('samsoncms_input_application')->createFieldByType($query, 4, $object, $this->name)->build(implode(',', $groupSelect)), 'field')->output();
 }
Exemplo n.º 2
0
 /** @inheritdoc */
 public function __construct(RenderInterface $renderer, QueryInterface $query, Record $entity, field $field)
 {
     // Check if material have this gallery additional field stored
     if (!$query->className('materialfield')->cond('MaterialID', $entity->id)->cond('FieldID', $field->id)->first($this->materialField)) {
         // Create materialfield object
         $this->materialField = new \samson\activerecord\materialfield(false);
         $this->materialField->FieldID = $field->id;
         $this->materialField->MaterialID = $entity->id;
         $this->materialField->Active = 1;
         $this->materialField->save();
     }
     // Form tab name
     $this->name = t(isset($field->Name[0]) ? $field->Name : $this->name, true);
     // Call parent constructor to define all class fields
     parent::__construct($renderer, $query, $entity);
 }
Exemplo n.º 3
0
 /**
  * Get entity from database by identifier
  * @param int $identifier Entity identifier
  * @param \samsonframework\orm\Record Found entity
  * @return boolean
  */
 protected function findEntityByID($identifier, &$entity, $entityName = null)
 {
     // If no specific entity name is passed use application default entity name
     $entityName = !isset($entityName) ? $this->entity : $entityName;
     return $this->query->className($entityName)->id($identifier)->first($entity);
 }
Exemplo n.º 4
0
 /**
  * Generic collection constructor
  * @param RenderInterface $renderer View render object
  * @param QueryInterface $query Query object
  */
 public function __construct(RenderInterface $renderer, QueryInterface $query, PagerInterface $pager)
 {
     // Call parent initialization
     parent::__construct($renderer, $query->className('material'), $pager);
 }