Exemple #1
0
 public function render()
 {
     /* bind optional action to field */
     if ($this->_obj->getAction()) {
         $this->_bindAction($this->_obj->getAction());
         View::addEvent(sprintf("jQuery('#%s').focus()", $this->_id), 'js');
     }
     $name = $this->getId();
     if ($this->getParameter('mode') == View\FormComponent::SEARCH_MODE) {
         $name = ViewUri::getUriAdapter()->getIdentifier('search') . '[' . $this->_nametoDomId($name) . ']';
     }
     $extraArgs = '';
     if ($this->getParameter('args')) {
         foreach ($this->getParameter('args') as $argKey => $argVal) {
             $extraArgs .= sprintf(' %s="%s"', $argKey, $argVal);
         }
     }
     $size = $this->getParameter('length');
     $max = $this->_obj->getConstraint(Property::CONSTRAINT_MAXLENGTH);
     if ($this->_obj->getValue()) {
         $html = sprintf('<input type="text" name="%s" id="%s" placeholder="%s" size="%s"%s value="********"%s/>', $name, $this->_obj->getId(), $this->_obj->getHelp(), $max > $size || $max == 0 ? $size : $max, $max ? ' maxlength="' . $max . '"' : null, $extraArgs);
         $html .= sprintf(' <a href="#" onclick="jQuery(\'#%s\').val(\'%s\').focus();this.remove()">Regénérer</a>', $this->_obj->getId(), self::password());
     } else {
         $html = sprintf('<input type="text" name="%s" id="%s" placeholder="%s" size="%s"%s value="%s"%s/>', $name, $this->_obj->getId(), $this->_obj->getHelp(), $max > $size || $max == 0 ? $size : $max, $max ? ' maxlength="' . $max . '"' : null, $this->_obj->getValue(), $extraArgs);
     }
     $this->addConstraintObserver(array(Property::CONSTRAINT_UPPERCASE, Property::CONSTRAINT_LOWERCASE));
     return $html;
 }
Exemple #2
0
 public function render()
 {
     $this->_collection = $this->_obj->getCollection();
     $this->_collection->setBoundaryBatch(-1);
     // set relevant uri adapter and get some identifiers
     /* @var $_uriAdapter t41\View\ViewUri\AbstractAdapter */
     if (!($this->_uriAdapter = ViewUri::getUriAdapter()) instanceof ViewUri\Adapter\GetAdapter) {
         $this->_uriAdapter = new ViewUri\Adapter\GetAdapter();
     }
     $this->_uriAdapter->setEnvData($this->_uriAdapter->getIdentifier('offset'), 0);
     $this->_obj->query($this->_uriAdapter);
     $row = '';
     $sep = str_replace('\\t', "\t", ",");
     // print out result rows
     foreach ($this->_obj->getCollection()->getMembers(ObjectModel::DATA) as $this->_do) {
         $p = null;
         foreach ($this->_obj->getColumns() as $key => $column) {
             if ($p) {
                 $p .= $sep;
             }
             if ($column instanceof Element\IdentifierElement) {
                 $value = $this->_do->getUri()->getIdentifier();
             } else {
                 if ($column instanceof Element\MetaElement) {
                     $value = $column->getDisplayValue($this->_do);
                 } else {
                     $property = $this->_do->getProperty($column->getParameter('property'));
                     $column->setValue($property->getValue());
                     if ($column->getParameter('recursion')) {
                         foreach ($column->getParameter('recursion') as $recursion) {
                             if ($property instanceof AbstractProperty) {
                                 $property = $property->getValue(ObjectModel::DATA);
                             }
                             if ($property instanceof ObjectModel || $property instanceof DataObject) {
                                 $property = $property->getProperty($recursion);
                             }
                         }
                     }
                     if ($property instanceof Property\MediaProperty) {
                         $value = '';
                     } else {
                         if ($property instanceof Property\CurrencyProperty) {
                             $value = $property->getValue();
                             // value formatting must not be converted
                         } else {
                             $value = $property instanceof Property\AbstractProperty ? $property->getDisplayValue() : null;
                         }
                     }
                 }
             }
             $fv = str_replace('\\r\\n', ', ', stripslashes($value));
             $p .= "\"" . str_replace('"', '""', $fv) . "\"";
         }
         $row .= $p . "\r\n";
         // preserve memory!
         $this->_do->reclaimMemory();
     }
     return $this->_drawHeaderRow() . $row;
 }
Exemple #3
0
 public function render()
 {
     // set correct name for field name value depending on 'mode' parameter value
     $name = $this->_obj->getId();
     if ($this->getParameter('mode') == View\FormComponent::SEARCH_MODE) {
         $name = ViewUri::getUriAdapter()->getIdentifier('search') . '[' . $name . ']';
         $this->setParameter('radiomax', 0);
     }
     $html = '';
     foreach ($this->_obj->getEnumValues() as $key => $val) {
         $uniqid = sprintf('%s_%s', $name, $key);
         $html .= sprintf('<input type="checkbox" name="%s[]" id="%s" value="%s"%s/>&nbsp;<label for="%s">%s</label> ', $name, $uniqid, $key, in_array($key, $this->_obj->getValue()) ? ' checked="checked"' : null, $uniqid, $this->_escape($val));
     }
     return $html;
 }
Exemple #4
0
 public function render()
 {
     $name = $this->_obj->getAltId();
     if ($this->getParameter('mode') == View\FormComponent::SEARCH_MODE) {
         $name = ViewUri::getUriAdapter()->getIdentifier('search') . '[' . $this->_nametoDomId($name) . ']';
     }
     $extraArgs = '';
     if ($this->getParameter('args')) {
         foreach ($this->getParameter('args') as $argKey => $argVal) {
             $extraArgs .= sprintf(' %s="%s"', $argKey, $argVal);
         }
     }
     $max = $this->_obj->getValueConstraint('maxval');
     $html = sprintf('<textarea name="%s" cols="50" id="%s" rows="%s">%s</textarea>', $name, $name, $max > 10 || $max == 0 ? 10 : $max, $this->_obj->getValue());
     $this->addConstraintObserver(array(Property::CONSTRAINT_UPPERCASE, Property::CONSTRAINT_LOWERCASE));
     return $html;
 }
Exemple #5
0
 public function render()
 {
     if (($value = $this->_obj->getValue()) !== false) {
         if (($value instanceof ObjectModel\BaseObject || $value instanceof ObjectModel\DataObject) && $value->getUri()) {
             $value = $this->_obj->getParameter('altkey') ? $value->getProperty($this->_obj->getParameter('altkey'))->getValue() : $value->getUri()->getIdentifier();
         } else {
             if ($value instanceof ObjectModel\ObjectUri) {
                 $value = $value->getIdentifier();
             } else {
                 $value = null;
             }
         }
     }
     $name = $this->_obj->getId();
     // set correct name for field name value depending on 'mode' parameter value
     if ($this->getParameter('mode') == View\FormComponent::SEARCH_MODE) {
         $name = ViewUri::getUriAdapter()->getIdentifier('search') . '[' . $name . ']';
     }
     View::addCoreLib(array('core.js', 'locale.js', 'view.js', 'view:table.js', 'view:action:autocomplete.js'));
     $acfield = new View\FormComponent\Element\FieldElement('_' . $this->_nametoDomId($name));
     $acfield->setValue($value);
     $action = new AutocompleteAction($this->_obj->getCollection());
     $objsearchprops = $this->_obj->getParameter('search') ? $this->_obj->getParameter('search') : $this->_obj->getParameter('display');
     $action->setParameter('searchprops', explode(',', $this->getParameter('searchprops') ? $this->getParameter('searchprops') : $objsearchprops));
     $action->setParameter('searchmode', $this->getParameter('searchmode'));
     $action->setParameter('display', explode(',', $this->_obj->getParameter('display')));
     $action->setParameter('sdisplay', explode(',', $this->_obj->getParameter('sdisplay') ? $this->_obj->getParameter('sdisplay') : $this->_obj->getParameter('display')));
     $action->setParameter('event', 'keyup');
     // if a list of properties to be returned exists, pass it to the action
     if ($this->getParameter('retprops')) {
         $action->setParameter('member_reduce_params', array('props' => explode(',', $this->getParameter('retprops'))));
     }
     $action->setContextData('onclick', 't41.view.element.autocomplete.close');
     $action->setContextData('target', $this->_nametoDomId($name));
     $action->bind($acfield);
     $deco = View\Decorator::factory($acfield);
     $html = $deco->render();
     $deco = View\Decorator::factory($action);
     $deco->render();
     $html .= sprintf('<input type="hidden" name="%s" id="%s" value="%s"/>', $name, $this->_nametoDomId($name), $value);
     return $html . "\n";
 }
Exemple #6
0
 public function render()
 {
     // set correct name for field name value depending on 'mode' parameter value
     $name = $this->_obj->getId();
     if ($this->getParameter('mode') == View\FormComponent::SEARCH_MODE) {
         $name = ViewUri::getUriAdapter()->getIdentifier('search') . '[' . $name . ']';
         $this->setParameter('radiomax', 0);
     }
     if (count($this->_obj->getEnumValues()) > $this->getParameter('radiomax')) {
         // display menu list
         $options = array(null => $this->getParameter('defaultlabel')) + (array) $this->_obj->getEnumValues();
         $zv = new \Zend_View();
         return $zv->formSelect($name, $this->_obj->getValue(), null, $options);
     } else {
         $html = '';
         foreach ($this->_obj->getEnumValues() as $key => $val) {
             $html .= sprintf('<input type="radio" name="%s" id="%s_%s" value="%s"%s/>&nbsp;<label for="%s_%s">%s</label> ', $name, $name, $key, $key, $key == $this->_obj->getValue() ? ' checked="checked"' : null, $name, $key, $this->_escape($val));
         }
         return $html;
     }
 }
Exemple #7
0
 public function render()
 {
     /* bind optional action to field */
     if ($this->_obj->getAction()) {
         $this->_bindAction($this->_obj->getAction());
         View::addEvent(sprintf("jQuery('#%s').focus()", $this->_id), 'js');
     }
     $name = $this->getId();
     if ($this->getParameter('mode') == View\FormComponent::SEARCH_MODE) {
         $name = ViewUri::getUriAdapter()->getIdentifier('search') . '[' . $this->_nametoDomId($name) . ']';
     }
     $html = sprintf('<input type="hidden" name="%s" id="%s" value="%s"/>', $name, $this->_obj->getId(), $this->_obj->getValue());
     $zv = new \Zend_View();
     $options = array(null => $this->getParameter('defaultlabel')) + $this->_obj->getEnumValues(TimeProperty::HOUR_PART);
     $html .= $zv->formSelect($name . '_hour', $this->_obj->getValue(TimeProperty::HOUR_PART), null, $options);
     $options = array(null => $this->getParameter('defaultlabel')) + $this->_obj->getEnumValues(TimeProperty::MIN_PART);
     $html .= ' : ' . $zv->formSelect($name . '_minute', $this->_obj->getValue(TimeProperty::MIN_PART), null, $options);
     View::addCoreLib('view:form.js');
     View::addEvent(sprintf("new t41.view.form.timeElement('%s')", $this->_obj->getId()), 'js');
     return $html;
 }
Exemple #8
0
 public function render()
 {
     /* bind optional action to field */
     if ($this->_obj->getAction()) {
         $this->_bindAction($this->_obj->getAction());
         View::addEvent(sprintf("jQuery('#%s').focus()", $this->_id), 'js');
     }
     $name = $this->getId();
     $value = explode('.', $this->_obj->getValue());
     if ($this->getParameter('mode') == View\FormComponent::SEARCH_MODE) {
         $name = ViewUri::getUriAdapter()->getIdentifier('search') . '[' . $this->_nametoDomId($name) . ']';
     }
     $html = sprintf('<input type="hidden" name="%s" id="%s" value="%s"/>', $name, $this->_obj->getId(), $this->_obj->getValue());
     $html .= sprintf('<input type="text" id="%s_number" size="3" maxlength="4"/>', $this->_obj->getId());
     $options = array('2' => 'Bis', '3' => 'Ter', '4' => 'Quater', 'A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D');
     $options = array(null => $this->getParameter('defaultlabel')) + $options;
     $zv = new \Zend_View();
     $html .= $zv->formSelect(null, null, array('id' => $this->_obj->getId() . '_ext'), $options);
     View::addCoreLib('view:form.js');
     View::addEvent(sprintf("new t41.view.form.streetNumber('%s')", $this->_obj->getId()), 'js');
     return $html;
 }
Exemple #9
0
 public function render()
 {
     if (($value = $this->_obj->getValue()) !== false) {
         if (($value instanceof ObjectModel\BaseObject || $value instanceof ObjectModel\DataObject) && $value->getUri()) {
             $value = $this->_obj->getParameter('altkey') ? $value->getProperty($this->_obj->getParameter('altkey'))->getValue() : $value->getUri()->getIdentifier();
         } else {
             if ($value instanceof ObjectModel\ObjectUri) {
                 $value = $value->getIdentifier();
             } else {
                 if ($this->_obj->getDefaultValue()) {
                     $value = is_object($this->_obj->getDefaultValue()) ? $this->_obj->getDefaultValue()->getIdentifier() : $this->_obj->getDefaultValue();
                 } else {
                     $value = null;
                 }
             }
         }
     }
     // display autocompleter field
     if ($this->_obj->getTotalValues() > $this->_obj->getParameter('selectmax')) {
         $params = array();
         foreach ($this->_params as $key => $param) {
             $params[$key] = $param->getValue();
         }
         $deco = new WebAutocomplete($this->_obj, $params);
         return $deco->render();
     } else {
         // set correct name for field name value depending on 'mode' parameter value
         $name = $this->_obj->getId();
         if ($this->getParameter('mode') == View\FormComponent::SEARCH_MODE) {
             $name = ViewUri::getUriAdapter()->getIdentifier('search') . '[' . $name . ']';
         }
         // display menu list
         $zv = new \Zend_View();
         $options = array(Property::EMPTY_VALUE => $this->getParameter('defaultlabel')) + (array) $this->_obj->getEnumValues();
         return $zv->formSelect($name, $value, null, $options);
     }
 }
Exemple #10
0
    public function render()
    {
        View::addCoreLib(array('style.css', 'buttons.css', 'sprites.css'));
        // set relevant uri adapter and get some identifiers
        if (!ViewUri::getUriAdapter() instanceof ViewUri\Adapter\GetAdapter) {
            // set url base
            $tmp = explode('?', $_SERVER['REQUEST_URI']);
            $this->_uriAdapter = new ViewUri\Adapter\GetAdapter($tmp[0]);
        } else {
            $this->_uriAdapter = ViewUri::getUriAdapter();
        }
        $this->_offsetIdentifier = $this->_uriAdapter->getIdentifier('offset');
        $this->_sortIdentifier = $this->_uriAdapter->getIdentifier('sort');
        $this->_searchIdentifier = $this->_uriAdapter->getIdentifier('search');
        if (count($this->_uriAdapter->getEnv()) != 0) {
            $this->_uriAdapter->saveSearchTerms();
        } else {
            // try and restore cached search terms for the current uri
            $this->_uriAdapter->restoreSearchTerms();
        }
        // set data source for environment
        $this->_env = $this->_uriAdapter->getEnv();
        $p = $this->_headerRendering();
        $p .= $this->_contentRendering();
        $status = $this->_obj->getParameter('open_default') ? 'open' : 'close';
        $status .= $this->_obj->getParameter('locked') ? ' locked' : '';
        $title = $this->_obj->getTitle() ? $this->_obj->getTitle() : 'Recherche';
        $html_head = <<<HTML
\t<div class="t41 component white medium" id="{$this->getId()}">
\t\t<h4 class="title slide_toggle {$status}"><div class="icon"></div>{$title}</h4>
\t\t<div class="content">
HTML;
        // save search terms
        //$this->_uriAdapter->saveSearchTerms($searchTermsSessionKey);
        return $html_head . $p . '</form></div></div>';
    }
Exemple #11
0
 public function render()
 {
     View::addModuleLib('jquery-ui-1.8.9.custom.js', 'vendor/jquery/jqueryui');
     View::addModuleLib('jquery-ui-1.8.9.custom.css', 'vendor/jquery/jqueryui');
     $name = $this->getId();
     if ($this->getParameter('mode') == View\FormComponent::SEARCH_MODE) {
         $name = ViewUri::getUriAdapter()->getIdentifier('search') . '[' . $this->_nametoDomId($name) . ']';
     }
     switch ($this->getParameter('mode')) {
         case View\FormComponent::SEARCH_MODE:
             $so = ViewUri::getUriAdapter()->getIdentifier('search');
             $dataArray = isset($_GET[$so][$this->_obj->getAltId()]) ? $_GET[$so][$this->_obj->getAltId()] : array();
             $html = $this->_renderField($so . '[' . $this->_obj->getAltId() . '][from]', isset($dataArray['from']) ? $dataArray['from'] : NULL, 'du', false) . $this->_renderField($so . '[' . $this->_obj->getAltId() . '][to]', isset($dataArray['to']) ? $dataArray['to'] : NULL, 'au', false);
             break;
         default:
             if (($this->_obj->getConstraint('neditable') == 'Y' || $this->getParameter('noteditable') == 'Y') && $this->_obj->getValue() != null) {
                 $html = $this->_obj->formatValue($this->_obj->getValue());
             } else {
                 $html = $this->_renderField($name, $this->_obj->getValue());
             }
             break;
     }
     return $html;
 }
Exemple #12
0
 public function render()
 {
     // add CSS libraries
     View::addCoreLib(array('sprites.css', 'buttons.css'));
     $extraHtml = array();
     $class = explode(' ', $this->getParameter('css'));
     if ($this->getParameter('nolabel') != true) {
         $class[] = 'button';
     }
     if ($this->getParameter('size')) {
         $class[] = $this->getParameter('size');
     }
     if ($this->getParameter('color')) {
         $class[] = $this->getParameter('color');
     }
     /* bind optional action to button */
     if ($this->_obj->getAction()) {
         $this->_bindAction($this->_obj->getAction());
     } else {
         if ($this->_obj->getLink()) {
             $link = $this->_obj->getLink();
             $uri = $this->_obj->getParameter('uri');
             if ($uri instanceof ObjectUri && substr($link, 0, 1) == '/') {
                 $link .= '/id/' . rawurlencode($uri->getIdentifier());
             }
             if (substr($link, 0, 4) == 't41.') {
                 $extraHtml[] = sprintf("onclick=\"%s\"", $link);
             } else {
                 $extraHtml[] = sprintf("onclick=\"t41.view.link('%s', jQuery('#%s'))\"", $link, $this->getId());
             }
         } else {
             $data = $this->getParameter('data');
             $adapter = ViewUri::getUriAdapter();
             $args = array();
             foreach ((array) $this->_obj->getParameter('identifiers') as $key => $identifier) {
                 $identifierKey = is_numeric($key) ? $identifier : $key;
                 $args[$identifierKey] = $data[$identifier];
             }
             $onclick = "document.location='" . "/";
             //$this->_obj->getUri();
             $onclick .= count($args) > 0 ? $adapter->makeUri($args, true) . "'" : "'";
         }
     }
     if ($this->_obj->getParameter('disabled')) {
         $class[] = 'disabled';
     }
     if ($this->getParameter('pairs')) {
         foreach ($this->getParameter('pairs') as $key => $val) {
             $extraHtml[] = sprintf('%s="%s"', $key, $val);
         }
     }
     if ($this->getParameter('icon')) {
         $class[] = 'icon';
     }
     $value = $this->getParameter('nolabel') ? '' : $this->_escape($this->_obj->getTitle());
     foreach ((array) $this->getParameter('data') as $key => $val) {
         $extraHtml[] = sprintf('data-%s="%s"', $key, $val);
     }
     $html = sprintf('<a class="%s" id="%s" data-help="%s" %s><span class="%s"></span>%s</a>', implode(' ', $class), $this->_id, '', implode(' ', $extraHtml), $this->getParameter('icon') ? $this->getParameter('icon') : null, $value);
     return $html;
 }
Exemple #13
0
 public function render(\TCPDF $pdf, $width)
 {
     $this->_collection = $this->_obj->getCollection();
     // set relevant uri adapter and get some identifiers
     if (!ViewUri::getUriAdapter() instanceof ViewUri\Adapter\GetAdapter) {
         $tmp = explode('?', $_SERVER['REQUEST_URI']);
         $this->_uriAdapter = new ViewUri\Adapter\GetAdapter($tmp[0]);
     } else {
         $this->_uriAdapter = ViewUri::getUriAdapter();
     }
     $this->_offsetIdentifier = $this->_uriAdapter->getIdentifier('offset');
     $this->_sortIdentifier = $this->_uriAdapter->getIdentifier('sort');
     $this->_searchIdentifier = $this->_uriAdapter->getIdentifier('search');
     // set data source for environment
     $this->_env = $this->_uriAdapter->getEnv();
     $this->_uriAdapter->setEnvData($this->_uriAdapter->getIdentifier('offset'), 0);
     $this->_obj->query($this->_uriAdapter);
     // calculate columns & alignment for each column
     foreach ($this->_obj->getColumns() as $key => $column) {
         // minimum column width should be based on label width
         $this->_colsWidth[$key] = strlen($column->getTitle());
         $this->_colsAlignment[$key] = $column->getParameter('align');
     }
     /* add optional extra columns */
     if ($this->getParameter('extra_cols') > 0) {
         for ($i = 0; $i < $this->getParameter('extra_cols'); $i++) {
             $this->_colsWidth[] = 10;
         }
     }
     $i = 0;
     $rows = $this->_obj->getCollection();
     $sampleLength = $rows->getTotalMembers() > 30 ? 30 : $rows->getTotalMembers();
     // now walk through a sample of all data rows to find longest value for each column
     while ($i < $sampleLength) {
         $rnd = rand(0, $rows->getTotalMembers() - 1);
         // get a random row
         if (($data = $rows->getMember($rnd, ObjectModel::MODEL)) === false) {
             continue;
         }
         foreach ($this->_obj->getColumns() as $key => $column) {
             $property = $data->getProperty($column->getParameter('property'));
             if ($column->getParameter('recursion')) {
                 foreach ($column->getParameter('recursion') as $recursion) {
                     if ($property instanceof AbstractProperty) {
                         $property = $property->getValue(ObjectModel::DATA);
                     }
                     if ($property instanceof ObjectModel || $property instanceof DataObject) {
                         $property = $property->getProperty($recursion);
                     }
                 }
             }
             $value = $property instanceof AbstractProperty ? $property->getDisplayValue() : null;
             $content = explode("\n", $value);
             $strlen = strlen($content[0]);
             if ($strlen > $this->_colsWidth[$key]) {
                 $this->_colsWidth[$key] = $strlen;
             }
         }
         $i++;
     }
     $floor = array_sum($this->_colsWidth) * 0.05;
     // adds 50% to cols using less than 5% of total */
     foreach ($this->_colsWidth as $key => $colWidth) {
         if ($colWidth > $floor) {
             continue;
         }
         $this->_colsWidth[$key] = $colWidth * 1.5;
     }
     // compute total length of columns
     $fullLine = array_sum($this->_colsWidth);
     // attribute width in percent of total width
     foreach ($this->_colsWidth as $key => $colWidth) {
         $this->_colsWidth[$key] = round($width * ($colWidth / $fullLine));
     }
     /* number of columns, useful to know when to terminate a row */
     $this->_cols = $cols = count($this->_colsWidth);
     /* draw header row */
     $this->_drawHeaderRow($pdf);
     /* number of data columns, useful to retrieve extra ones */
     $dcols = count($this->_obj->getColumns());
     /* calculate the value of the necessary space to draw a new cell */
     $increment = $this->_cellHeight + $this->_headerHeight;
     //if (! is_null($this->_groups)) $increment += $this->_headerHeight;
     /* print data */
     foreach ($this->_obj->getCollection()->getMembers(ObjectModel::DATA) as $this->_do) {
         /* test if a new page is necessary */
         if ($pdf->getY() + $increment > $pdf->getPageHeight() - 20) {
             $pdf->AddPage();
             $this->_drawHeaderRow($pdf);
         }
         $index = 0;
         foreach ($this->_obj->getColumns() as $key => $column) {
             if ($index + 1 == $cols) {
                 $index = 0;
                 $nextPos = 1;
             } else {
                 $nextPos = 0;
                 $index++;
             }
             if ($column instanceof Element\IdentifierElement) {
                 $value = $this->_do->getUri()->getIdentifier();
             } else {
                 if ($column instanceof Element\MetaElement) {
                     $attrib = $column->getParameter('type') == 'currency' ? ' class="cellcurrency"' : null;
                     $p .= "<td{$attrib}>" . $column->getDisplayValue($this->_do) . '</td>';
                 } else {
                     $property = $this->_do->getProperty($column->getParameter('property'));
                     if (!$property) {
                         $pdf->Multicell($this->_colsWidth[$key], $this->_cellHeight, '??', 1, $this->_colsAlignment[$key], 0, $nextPos);
                         continue;
                     }
                     $column->setValue($property->getValue());
                     if ($column->getParameter('recursion')) {
                         foreach ($column->getParameter('recursion') as $recursion) {
                             if ($property instanceof AbstractProperty) {
                                 $property = $property->getValue(ObjectModel::DATA);
                             }
                             if ($property instanceof ObjectModel || $property instanceof DataObject) {
                                 $property = $property->getProperty($recursion);
                             }
                         }
                     }
                     if ($property instanceof Property\MediaProperty) {
                         $column->setValue($property->getDisplayValue());
                         $deco = Decorator::factory($column);
                         $value = $deco->render();
                     } else {
                         $value = $property instanceof Property\AbstractProperty ? $property->getDisplayValue() : null;
                     }
                 }
             }
             // put value in cell
             $pdf->Multicell($this->_colsWidth[$key], $this->_cellHeight, $value, 1, $this->_colsAlignment[$key], 0, $nextPos);
         }
         /* display optional extra cols */
         if ($this->getParameter('extra_cols') > 0) {
             for ($i = 0; $i < $this->getParameter('extra_cols'); $i++) {
                 $pdf->Cell($this->_colsWidth[$dcols + $i], $this->_cellHeight, null, 1, (int) ($i + $index + 1 == $cols));
             }
         }
     }
 }
Exemple #14
0
 public function render()
 {
     View::addCoreLib(array('style.css', 'buttons.css', 'sprites.css'));
     View::addCoreLib(array('core.js', 'view.js', 'view:alert.js'));
     // @todo temp fix, sorting by headers is only available on page refresh
     if ($this->getParameter('paginator') == false) {
         $this->setParameter('sortable', false);
     }
     // set relevant uri adapter and get some identifiers
     /* @var $_uriAdapter t41\View\ViewUri\AbstractAdapter */
     if (!ViewUri::getUriAdapter() instanceof ViewUri\Adapter\GetAdapter) {
         $tmp = explode('?', $_SERVER['REQUEST_URI']);
         $this->_uriAdapter = new ViewUri\Adapter\GetAdapter($tmp[0]);
     } else {
         $this->_uriAdapter = ViewUri::getUriAdapter();
     }
     $this->_offsetIdentifier = $this->_uriAdapter->getIdentifier('offset');
     $this->_sortIdentifier = $this->_uriAdapter->getIdentifier('sort');
     $this->_searchIdentifier = $this->_uriAdapter->getIdentifier('search');
     $this->_env = $this->_uriAdapter->getEnv();
     if (!$this->_obj->getCollection() instanceof StatsCollection) {
         $this->_obj->query($this->_uriAdapter);
     }
     $tmp = $this->_obj->reduce();
     $this->_uuid = $tmp['uuid'];
     $p = '';
     $p = $this->_headerRendering();
     $p .= sprintf('<table class="t41 list" id="%s">', $this->getId());
     $p .= $this->_headlineRendering();
     $p .= $this->_contentRendering();
     $p .= '</table>';
     // inject extra content
     $p .= '<div class="actions">' . parent::_contentRendering() . '</div>';
     if ($this->getParameter('paginator') !== false) {
         $p .= $this->_footerRendering();
     } else {
         $p .= '</div></div>';
     }
     return $p;
 }