Example #1
0
 /**
  * An iframe element.
  *
  * Any extra parameters are added as either content, attributes or handled
  * as special types, if defined as such for this element.
  *
  * @param mixed $src We assume the first element is src, unless a later element is explicitly specified as such
  * @param mixed $arg_array \MUtil_Ra::args arguments
  */
 public function __construct($src, $arg_array = null)
 {
     $args = \MUtil_Ra::args(func_get_args(), array('src' => 'MUtil_Html_SrcArrayAttribute'));
     if (isset($args['src']) && !$args['src'] instanceof \MUtil_Html_AttributeInterface) {
         $args['src'] = new \MUtil_Html_SrcArrayAttribute($args['src']);
     }
     parent::__construct('iframe', $args);
 }
 /**
  * Creates the model
  *
  * @return \MUtil_Model_ModelAbstract
  */
 protected function createModel()
 {
     if ($this->model instanceof \Gems_Model_AppointmentModel) {
         $model = $this->model;
     } else {
         $model = $this->loader->getModels()->createAppointmentModel();
         $model->applyBrowseSettings();
     }
     $model->addColumn(new \Zend_Db_Expr("CONVERT(gap_admission_time, DATE)"), 'date_only');
     $model->set('date_only', 'formatFunction', array($this, 'formatDate'));
     // 'dateFormat', \Zend_Date::DAY_SHORT . ' ' . \Zend_Date::MONTH_NAME . ' ' . \Zend_Date::YEAR);
     $model->set('gap_admission_time', 'label', $this->_('Time'), 'formatFunction', array($this, 'formatTime'));
     // 'dateFormat', 'HH:mm ' . \Zend_Date::WEEKDAY);
     $this->_dateStorageFormat = $model->get('gap_admission_time', 'storageFormat');
     // $this->_timeImg           = \MUtil_Html::create('img', array('src' => 'stopwatch.png', 'alt' => ''));
     $model->set('gr2o_patient_nr', 'label', $this->_('Respondent nr'));
     if ($this->respondent instanceof \Gems_Tracker_Respondent) {
         $model->addFilter(array('gap_id_user' => $this->respondent->getId(), 'gap_id_organization' => $this->respondent->getOrganizationId()));
     }
     return $model;
 }
Example #3
0
 /**
  * If the target attribute is specified and no onclick attribute is specified the target is removed and
  * a compatible javascript onclick attribute is created.
  *
  * @param array $attribs From this array, each key-value pair is
  * converted to an attribute name and value.
  *
  * @return string The XHTML for the attributes.
  */
 protected function _htmlAttribs($attribs)
 {
     if (isset($attribs['target']) && !isset($attribs['onclick'])) {
         // Assumption that is not tested, but when clicking on a target link, no further bubble is needed.
         $attribs['onclick'] = "event.cancelBubble = true;";
     }
     return parent::_htmlAttribs($attribs);
 }
 /**
  *
  * @staticvar \MUtil_Html_HtmlElement $blank What to display when blank
  * @param \MUtil_Html_HtmlElement $td      The element / cell to add the conditional link
  * @param \MUtil_Model_Bridge_TableBridge $bridge
  * @param string $icon                    Name of icon file
  * @param \Gems_Menu_SubMenuItem $menuItem The menu item to add
  * @param mixed $options                  Other values for for link (not used for blank)
  * @return void
  */
 protected function addFileImage(\MUtil_Html_HtmlElement $td, \MUtil_Model_Bridge_TableBridge $bridge, $icon, \Gems_Menu_SubMenuItem $menuItem = null, $options = null)
 {
     static $blank;
     if (!$menuItem) {
         return;
     }
     if (!$blank) {
         $blank = \MUtil_Html::create('img', array('src' => 'blank.png', 'alt' => '', 'class' => 'file-icon'));
     }
     $href = $menuItem->toHRefAttribute($this->request, $bridge);
     $title = array(strtolower($menuItem->get('label')), $bridge->relpath);
     $img = \MUtil_Html::create('img', array('src' => $icon, 'alt' => $title, 'class' => 'file-icon'));
     $td->iflink($href, array($href, $img, array('title' => $title), $options), $blank);
 }
Example #5
0
 public function __construct($arg_array = null)
 {
     $args = \MUtil_Ra::args(func_get_args());
     parent::__construct('div', array('class' => 'form-group'), $args);
 }
Example #6
0
 public function __construct($arg_array = null)
 {
     $args = \MUtil_Ra::args(func_get_args());
     parent::__construct('p', $args);
 }
Example #7
0
 /**
  * Function to allow overloading of tag rendering only
  *
  * Renders the element tag with it's content into a html string
  *
  * The $view is used to correctly encode and escape the output
  *
  * @param \Zend_View_Abstract $view
  * @return string Correctly encoded and escaped html output
  */
 protected function renderElement(\Zend_View_Abstract $view)
 {
     if ($this->_lastChild) {
         $this->_lastChild->class = $this->progressTextClass;
         // These style elements inline because they are REQUIRED to make the panel work.
         //
         // Making the child position absolute means it is positioned over the content that
         // the JQuery progress widget displays (the bar itself) and so this solution allows
         // the text to be displayed over the progress bar (when it has a relative position).
         //
         // The elements should be display neutral.
         //
         $this->_lastChild->style = 'left: 0; height: 100%; position: absolute; top: 0; width: 100%;';
         $this->style = 'position: relative;';
     }
     return parent::renderElement($view);
 }
Example #8
0
 /**
  * Function to allow overloading  of tag rendering only
  *
  * Renders the element tag with it's content into a html string
  *
  * The $view is used to correctly encode and escape the output
  *
  * @param \Zend_View_Abstract $view
  * @return string Correctly encoded and escaped html output
  */
 protected function renderElement(\Zend_View_Abstract $view)
 {
     if (isset($this->_attribs['src'])) {
         if (is_scalar($this->_attribs['src'])) {
             $src = $this->_attribs['src'];
         } else {
             $src = \MUtil_Html::getRenderer()->renderArray($view, array($this->_attribs['src']));
         }
     } else {
         $src = false;
     }
     if ($src || $this->renderWithoutSrc) {
         return parent::renderElement($view);
     }
 }
Example #9
0
 /**
  * Returns a button that can be clicked to start the progress bar.
  *
  * @param mixed $arg_array \MUtil_Ra::args() arguments to populate link with
  * @return \MUtil_Html_HtmlElement
  */
 public function getStartButton($args_array = 'Start')
 {
     $args = \MUtil_Ra::args(func_get_args());
     $args['onclick'] = 'if (! this.disabled) {' . $this->getFunctionPrefix() . 'Start();} this.disabled = true; event.cancelBubble=true;';
     $button = new \MUtil_Html_HtmlElement('button', $args);
     $button->appendAttrib('class', $this->_buttonClass . ' btn-succes');
     return $button;
 }
Example #10
0
 /**
  * Function to allow overloading  of tag rendering only
  *
  * Renders the element tag with it's content into a html string
  *
  * The $view is used to correctly encode and escape the output
  *
  * @param \Zend_View_Abstract $view
  * @return string Correctly encoded and escaped html output
  */
 protected function renderElement(\Zend_View_Abstract $view)
 {
     $result = parent::renderElement($view);
     if ($this->_onlyWhenChanged) {
         if ($result == $this->_onlyWhenChangedValueStore) {
             return null;
         }
         $this->_onlyWhenChangedValueStore = $result;
     }
     return $result;
 }
Example #11
0
 /**
  * Function to allow overloading  of tag rendering only
  *
  * Renders the element tag with it's content into a html string
  *
  * The $view is used to correctly encode and escape the output
  *
  * @param \Zend_View_Abstract $view
  * @return string Correctly encoded and escaped html output
  */
 protected function renderElement(\Zend_View_Abstract $view)
 {
     $this->_currentContent = array();
     // If the label was assigned an element lazy,
     // now is the time to get it's value.
     foreach ($this->_content as $key => $value) {
         if ($value instanceof \MUtil_Lazy_LazyInterface) {
             $value = \MUtil_Lazy::rise($value);
         }
         if ($value instanceof \Zend_Form_Element) {
             if ($value instanceof \Zend_Form_Element_Hidden) {
                 return null;
             }
             // Only a label when a label decorator exists, but we do not use that decorator
             $decorator = $value->getDecorator('Label');
             if ($decorator) {
                 if (false === $decorator->getOption('escape')) {
                     $label = \MUtil_Html::raw($value->getLabel());
                 } else {
                     $label = $value->getLabel();
                 }
                 $class = $this->class ? \MUtil_Html::renderAny($view, $this->class) . ' ' : '';
                 if ($value->isRequired()) {
                     $class .= $this->getRequiredClass();
                     $this->_currentContent[$key] = array($this->getRequiredPrefix(), $label, $this->getRequiredPostfix());
                 } else {
                     $class .= $this->getOptionalClass();
                     $this->_currentContent[$key] = array($this->getOptionalPrefix(), $label, $this->getOptionalPostfix());
                 }
                 parent::__set('class', $class);
                 // Bypass existing property for drawing
                 if ($id = $value->getId()) {
                     parent::__set('for', $id);
                     // Always overrule
                 } else {
                     parent::__unset('for');
                 }
             }
         } elseif ($value instanceof \Zend_Form_DisplayGroup) {
             return null;
         } else {
             $this->_currentContent[$key] = $value;
         }
     }
     return parent::renderElement($view);
 }
Example #12
0
 /**
  * Applies the $this=>attributes and $this->class snippet parameters to the
  * $html element.
  *
  * @param \MUtil_Html_HtmlElement $html Element to apply the snippet parameters to.
  */
 protected function applyHtmlAttributes(\MUtil_Html_HtmlElement $html)
 {
     if ($this->attributes) {
         foreach ($this->attributes as $name => $value) {
             if (!is_numeric($name)) {
                 $html->appendAttrib($name, $value);
             }
         }
     }
     if ($this->class) {
         $html->appendAttrib('class', $this->class);
     }
 }
Example #13
0
 /**
  * Repeat the element when rendering.
  *
  * When repeatTags is false (the default) only the content is repeated but
  * not the element tags. When repeatTags is true the both the tags and the
  * content are repeated.
  *
  * @param mixed $repeater \MUtil_Lazy_RepeatableInterface or something that can be made into one.
  * @param mixed $onEmptyContent Optional. When not null the content to display when the repeater does not result in data is set.
  * @param boolean $repeatTags Optional when not null the repeatTags switch is set.
  * @param mixed $colcount \MUtil_Html_ColumnInterface or intefer. Span the onEmpty content over $colcount cells
  * @return \MUtil_Html_TBodyElement (continuation pattern)
  */
 public function setRepeater($repeater, $onEmptyContent = null, $repeatTags = null, $colcount = null)
 {
     parent::setRepeater($repeater, null, $repeatTags);
     if ($onEmptyContent) {
         $this->setOnEmpty($onEmptyContent, $colcount);
     }
     return $this;
 }