Ejemplo n.º 1
0
 public function vignetteIndividu($individu, $label = null, $urlOptions = array())
 {
     if (!$individu) {
         return;
     }
     $urlOptions = array_merge(array('controller' => 'individus', 'action' => 'fiche', 'individu' => $individu->slug), $urlOptions);
     $this->view->document->addStyleComponents('vignette');
     $label = $label ? $label : $individu->getFullname();
     $item = new Wtk_Container();
     $section = $item->addSection()->addFlags('wrapper');
     if ($this->view->assert(null, $individu, 'voir-avatar') && ($src = $individu->getCheminImage())) {
         $section->addImage($src, $individu->getFullname(), $individu->getFullname());
     } else {
         $section->addParagraph("Pas de photo")->addFlags('empty', 'image');
     }
     $item->addParagraph($label)->addFlags('label');
     if ($individu->slug) {
         $url = $this->view->url($urlOptions, true, true);
     } else {
         $url = null;
     }
     $link = new Wtk_Link($url, $label, $item);
     $link->addFlags('vignette', 'individu', 'avatar');
     return $link;
 }
Ejemplo n.º 2
0
 function __call($method, $args)
 {
     preg_match('/^add(.+)$/', $method, $matches);
     $class = 'Wtk_Form_Control_' . $matches[1];
     if (!@class_exists($class)) {
         /* Le contrôle n'existe pas, alors on délègue la créations d'enfant
          * courant. */
         return parent::__call($method, $args);
     }
     $instance = $i = array_shift($args);
     if (is_string($instance)) {
         try {
             $instance = $this->model->getInstance($instance);
         } catch (Exception $e) {
             $instance = null;
         }
     }
     if (!$instance) {
         throw new Exception("Can't retrieve instance '" . $i . "' " . "in model '" . $this->model->id . "'.");
     }
     $path = $instance->path;
     array_unshift($args, $instance);
     /* Ne fonctionne pas… */
     /* $el = wtk_new($class, $args); */
     $cargs = wtk_args_string("args", $args);
     $code = "\$el = new " . $class . "(" . implode(",", $cargs) . ");";
     eval($code);
     foreach ($this->model->constraints as $cons) {
         if ($cons->getInstance()->path == $instance->path) {
             $el->addFlags('constrained', $cons->getFlags());
         }
     }
     return $this->addChild($el);
 }
Ejemplo n.º 3
0
 public function vignettePhoto($photo, $label = null, $urlOptions = array())
 {
     if (!$photo) {
         return;
     }
     $urlOptions = array_merge(array('controller' => 'photos', 'action' => 'voir', 'photo' => $photo->slug), $urlOptions);
     $this->view->document->addStyleComponents('vignette');
     $label = $label ? $label : $photo;
     $page = Zend_Registry::get('page');
     $item = new Wtk_Container();
     $item->addSection()->addFlags('wrapper')->addImage($photo->getCheminVignette(), $photo->titre . ' ' . $page->metas->get('DC.Subject'), $photo->titre);
     $item->addParagraph($label)->addFlags('label');
     $link = new Wtk_Link($this->view->url($urlOptions, true, true) . '#document', $label, $item);
     $link->addFlags('vignette', 'photo', 'photo-' . $photo->slug);
     return $link;
 }
Ejemplo n.º 4
0
 function __construct($id, Wtk_Pages_Model $model, Wtk_Pages_Renderer $renderer)
 {
     parent::__construct();
     $this->id = $id;
     $this->renderer = $renderer;
     $this->model = $model;
     $this->stylecomponent = 'pages';
 }
Ejemplo n.º 5
0
 function __construct($label = NULL)
 {
     parent::__construct();
     if ($label) {
         $text = new WtkText($label);
         $this->addChild($text);
     }
     $this->template = 'button';
 }
Ejemplo n.º 6
0
 /**
  * Copy-pasted from Wtk_Form::addChild() :/
  */
 function addChild($wid)
 {
     $args = func_get_args();
     if (count($args) == 1 && $wid instanceof Wtk_Element) {
         return parent::addChild($wid);
     } else {
         $wid = call_user_func_array(array($this->getParent('Wtk_Form'), 'addChild'), $args);
         $wid->reparent($this);
     }
 }
Ejemplo n.º 7
0
 function __construct($label = null)
 {
     parent::__construct();
     if ($label) {
         $this->caption = new Wtk_Inline($label);
     } else {
         $this->caption = null;
     }
     $this->addFlags('control');
 }
Ejemplo n.º 8
0
 function __construct($src)
 {
     parent::__construct();
     $this->sources = array($src);
     $this->autoplay = false;
     $this->loop = false;
     $this->controls = true;
     $this->muted = false;
     $this->preload = false;
 }
Ejemplo n.º 9
0
 function __construct($model, $show_header = true, $class_col = null)
 {
     parent::__construct();
     $this->model = $model;
     $this->show_header = $show_header;
     $this->columns = array();
     $this->class_col = (array) $class_col;
     $this->cclasses = array();
     $this->setRowDojoType(null);
 }
Ejemplo n.º 10
0
 public function vignetteAlbum($album, $label = null, $urlOptions = array())
 {
     if (!$album) {
         return;
     }
     $this->view->document->addStyleComponents('vignette');
     $urlOptions = array_merge(array('controller' => 'photos', 'action' => 'consulter', 'album' => $album->slug), $urlOptions);
     $photo = $album->getPhotoAleatoire();
     $label = $label ? $label : $album->getIntituleCourt();
     $item = new Wtk_Container();
     $w = $item->addSection()->addFlags('wrapper');
     $item->addParagraph($label)->addFlags('label');
     $link = new Wtk_Link($this->view->url($urlOptions, true, true), $label, $item);
     $link->addFlags('vignette', 'album', 'album-' . $album->slug);
     if ($photo) {
         $w->addImage($photo->getCheminVignette(), $photo->titre, $album->getIntituleComplet());
     } else {
         $w->addParagraph("Pas d'image !")->addFlags('empty', 'image');
         $link->addFlags('empty');
     }
     return $link;
 }
Ejemplo n.º 11
0
 function __construct($href, $metas = NULL, $child = NULL)
 {
     parent::__construct();
     $this->metas = new Wtk_Metas(array('title' => is_string($metas) ? $metas : $href, 'label' => is_string($metas) ? $metas : basename($href)));
     if ($metas instanceof Wtk_Metas) {
         $this->metas->merge($metas);
     }
     if ($child instanceof Wtk_Element) {
         $this->addChild($child);
     } else {
         $this->addRawText($this->metas->label);
     }
     $this->metas = $this->metas;
     $this->href = $href;
 }
Ejemplo n.º 12
0
 function __construct($child = null, $ordered = false)
 {
     parent::__construct($child);
     $this->ordered = $ordered;
 }
Ejemplo n.º 13
0
 function __construct($label = NULL)
 {
     parent::__construct();
     $this->data['label'] = $label;
 }
Ejemplo n.º 14
0
 function __construct($ordered = FALSE, $reversed = FALSE)
 {
     parent::__construct();
     $this->setOrdered($ordered);
     $this->setReversed($reversed);
 }
Ejemplo n.º 15
0
 function __construct()
 {
     parent::__construct();
     $buttons = func_get_args();
     call_user_func_array(array($this, "addChildren"), $buttons);
 }
Ejemplo n.º 16
0
 function parent($wid)
 {
     parent::parent($wid);
     $this->_computeLevel();
 }
Ejemplo n.º 17
0
 function __construct($label)
 {
     parent::__construct();
     $this->addChild($label);
 }
Ejemplo n.º 18
0
 function __construct($row_path)
 {
     parent::__construct();
     $this->row_path = $row_path;
 }
Ejemplo n.º 19
0
 function __construct($title = NULL)
 {
     parent::__construct();
     $this->data['title'] = $title;
 }
Ejemplo n.º 20
0
 function __construct($text = '')
 {
     parent::__construct();
     $children = func_get_args();
     call_user_func_array(array(&$this, 'addChildren'), $children);
 }