Пример #1
0
 public function __construct($sitemap = TRUE, $filter = NULL, $desingated_parameter = [], $context = NULL, Loops $loops = NULL)
 {
     parent::__construct($context, $loops);
     if ($sitemap) {
         foreach (self::createSiteMap($filter, $desingated_parameter, $sitemap, $loops) as $key => $entry) {
             $this->offsetSet($key, $entry);
         }
     }
 }
 public function __construct(EntityAdmin $context, $parameter = [], Loops $loops = NULL)
 {
     parent::__construct($context, $loops);
     $classname = $context->entity;
     $doctrine = $this->loops->getService('doctrine');
     $metadata = $doctrine->getMetadataFactory()->getMetadataFor($classname);
     $identifier = $metadata->getIdentifier();
     $this->parameter = $parameter;
     $this->missing = count($identifier) - count($parameter) - 1 > 0;
 }
Пример #3
0
 public function __construct($default = NULL, $validators = [], $filters = [], $context = NULL, Loops $loops = NULL)
 {
     parent::__construct($context, $loops);
     $this->default = $default;
     $this->setValue($default);
     $this->messages = new MessageList(Message::ERROR);
     foreach ($validators as $validator) {
         $this->addValidator($validator);
     }
     foreach ($filters as $filter) {
         $this->addFilter($filter);
     }
 }
Пример #4
0
 public function __construct($entity, $persist = TRUE, $update = TRUE, $delete = TRUE, $list = TRUE, $list_filter = ["filtered_entity_list", "entity_admin"], $list_fields = [], $list_limit = 10, $list_alias = NULL, $list_order = [], $list_prepare_callback = NULL, $persist_filter = ["", "persist_entity"], $persist_fields = [], $update_filter = ["", "update_entity"], $update_fields = [], $context = NULL, Loops $loops = NULL)
 {
     parent::__construct($context, $loops);
     $this->entity = $entity;
     $this->persist = $persist;
     $this->persist_filter = $persist_filter;
     $this->persist_fields = $persist_fields;
     $this->update = $update;
     $this->update_filter = $update_filter;
     $this->update_fields = $update_fields;
     $this->delete = $delete;
     $this->list = $list;
     $this->list_alias = $list_alias;
     $this->list_order = $list_order;
     $this->list_limit = $list_limit;
     $this->list_filter = $list_filter;
     $this->list_fields = $list_fields;
     $this->list_prepare_callback = is_string($list_prepare_callback) ? [$context, $list_prepare_callback] : $list_prepare_callback;
 }
Пример #5
0
 public function __construct(ElementInterface $context, $page_parameter = NULL, Loops $loops = NULL)
 {
     parent::__construct($context, $loops);
     $loops = $this->getLoops();
     $annotations = $loops->getService("annotations");
     if ($page_parameter === NULL) {
         $page_parameter = $loops->getService("web_core")->page_parameter;
     }
     $reflection = new ReflectionClass(get_class($context));
     $entries = [];
     do {
         $classname = $reflection->getName();
         $annotation_set = $annotations->getStrict($classname);
         $annotation = $annotation_set->findFirst("Navigation\\PageEntry");
         $breadcrumb_annotation = $annotation_set->findFirst("Navigation\\Breadcrumb");
         $annotation_title = $annotation_set->findFirst("Navigation\\Title");
         if ($breadcrumb_annotation && $breadcrumb_annotation->ignore) {
             continue;
         }
         if ($breadcrumb_annotation && $breadcrumb_annotation->title) {
             $title = $breadcrumb_annotation->title;
         } elseif ($annotation && $annotation->title) {
             $title = $annotation->title;
         } elseif ($annotation_title && $annotation_title->title) {
             $title = $annotation_title->title;
         } else {
             continue;
         }
         $entry = new PageEntry(substr($classname, 6), $page_parameter, $title, $loops);
         if ($annotation && $annotation->link) {
             $entry->link = WebCore::getPagePathFromClassname("Pages\\" . $annotation->link, $page_parameter);
         }
         $entries[] = $entry;
     } while ($reflection = $reflection->getParentClass());
     foreach (array_reverse($entries) as $key => $entry) {
         $this->addChild($key, $entry);
     }
 }
Пример #6
0
 public function __construct($entity, $limit = 10, $alias = NULL, $order = [], $context = NULL, Loops $loops = NULL)
 {
     //set alias automatically based on classname
     if (!$alias) {
         $alias = strtolower(substr($entity, 0, 1));
     }
     $this->alias = $alias;
     $this->entity = is_object($entity) ? get_class($entity) : $entity;
     $this->limit = $limit;
     parent::__construct($context, $loops);
     $loops = $this->getLoops();
     $doctrine = $loops->getService("doctrine");
     $this->builder = new QueryBuilder($doctrine->entity_manager);
     $this->builder->select($alias);
     $this->builder->from(is_object($entity) ? get_class($entity) : $entity, $alias);
     foreach ($order as $key => $value) {
         if (is_array($value) && is_numeric($key)) {
             $this->builder->addOrderBy($this->alias . "." . $value[0], $value[1]);
         } else {
             $this->builder->addOrderBy($this->alias . "." . $key, $value);
         }
     }
 }
Пример #7
0
 public function __construct($object, $context = NULL, Loops $loops = NULL)
 {
     parent::__construct($context, $loops);
     $this->wrapped_object = $object;
 }
Пример #8
0
 /**
  * The Page constructor
  *
  * In most cases, the page is instantiated by the WebCore service.
  * If the Page class has underscore namespaces in its name or is called underscore, then for each found
  * underscore a parameter will be extracted from the accessed url. (see WebCore for details)
  * These parameters are passed to the constructor.
  *
  * @param array $parameter Page parameter for this page, these are typically extracted from the accessed url.
  * @param Loops The Loops context
  */
 public function __construct($parameter = [], Loops $loops = NULL)
 {
     parent::__construct(NULL, $loops);
     $this->parameter = $parameter;
 }
Пример #9
0
 /**
  * Construct a form object
  *
  * Form elements will be added to the form based on annotations.
  * Loops will look for annotations of the type 'Loops\Annotations\Form\Element',
  * 'Loops\Annotations\Form\Validator' and 'Loops\Annotations\Form\Filter' on properties.
  *
  * Annotations are collected from two places.
  *
  * 1. The passed entity
  *     If the passed default value (entity) is an object, the properties of its class definition will be inspected for annotations.
  *     For every annotation found, a form element is added.
  *     If the object (entity) has listeners to form events, they will also be fired on the object in case an event is fired for this form.
  * 2. The form itself
  *     Properties of the class instances defining class will also be inspected for annotations.
  *     This is particulary useful when extending from this class.
  *     Otherwise no annotations will be found since this class itself does not define any.
  *
  * Annotations from all parent classes will be collected.
  * For further information, see the documentation of method addFromAnnotations.
  *
  * @param ArrayAccess $value The default value/entity. If set to NULL, an empty Loops\ArrayObject will be created.
  * @param array|string Only use annotations marked with the specified filter(s) to generate form elements.
  * @param Loops The loops context to which this object belongs to.
  */
 public function __construct(ArrayAccess $value = NULL, $filter = "", $context = NULL, Loops $loops = NULL)
 {
     parent::__construct($context, $loops);
     $this->messages = new MessageList(Message::ERROR);
     $this->value = $value ?: new ArrayObject();
     if ($value) {
         $this->addFromAnnotations($value, $filter);
     }
     $this->addFromAnnotations($this, $filter);
 }
Пример #10
0
 /**
  * @param string $link The link for this entry
  * @param string $title A displayable title for this entry
  * @param string|Loops\Page $highlightgroup If the current page inherits the page given in this parameter, $highlight will be set to TRUE
  */
 public function __construct($link, $title, $context = NULL, Loops $loops = NULL)
 {
     parent::__construct($context, $loops);
     $this->link = $link;
     $this->title = $title;
 }