コード例 #1
0
ファイル: TableFm.php プロジェクト: rbraband/sefrengo
 /**
  * If pattern exists in $config_fields, a TableCellFormater is created
  * and the value is formated. The array $values is used as base for formatting.
  * @param array $config_fields Extract of the $config_fields for one field
  * @param array $values An associative array as array('fieldname' => 'value', ...)
  * @return string Returns the ready formated values as string
  */
 protected function _formatValues($config_fields, $values)
 {
     if (array_key_exists('format', $config_fields) == TRUE && array_key_exists('pattern', $config_fields['format']) == TRUE) {
         $formatter = null;
         if (sf_api_exists('VIEW', $config_fields['format']['classname']) == TRUE) {
             $formatter = sf_api('VIEW', $config_fields['format']['classname']);
         } else {
             if (sf_api_exists('VIEW', 'TableCellFormatter') == TRUE) {
                 $formatter = sf_api('VIEW', 'TableCellFormatter');
             }
         }
         if ($formatter instanceof SF_INTERFACE_TableCellFormatter) {
             $formatter->setItem($this->item);
             $value = $formatter->format($config_fields['format']['pattern'], $values);
         }
     } else {
         $value = implode(' ', $values);
         $value = htmlentities($value, ENT_COMPAT, 'UTF-8');
     }
     return $value;
 }
コード例 #2
0
ファイル: Table.php プロジェクト: rbraband/sefrengo
 /**
  * Builds and adds the footer with the links to select all or none
  * checkboxes and the multiple actions.
  * @param array $actions
  * @param array $options
  * @return void
  */
 public function buildTableFooterSelectMultiple($actions, $options)
 {
     $this->tpl->setCurrentBlock('FOOTER_SELECT_MULTIPLE');
     $tmp['COLSPAN'] = $options['colspan'];
     $tmp['LANG_SELECT'] = $options['select'];
     $tmp['SELECT_ALL'] = $options['select_all']['chk_name'];
     $tmp['LANG_SELECT_ALL'] = $options['select_all']['lang'];
     $tmp['SELECT_NONE'] = $options['select_none']['chk_name'];
     $tmp['LANG_SELECT_NONE'] = $options['select_none']['lang'];
     $tmp['TABLE_BODY_ATTRIBUTES'] = $actions['attributes_body'];
     // apply table cell renderer (tcr)
     if (array_key_exists('renderer', $actions) && array_key_exists('classname', $actions['renderer'])) {
         if (sf_api_exists('VIEW', $actions['renderer']['classname']) == TRUE) {
             $renderer = sf_api('VIEW', $actions['renderer']['classname']);
             $renderer->setRendererConfig($actions['renderer']);
             $renderer->setConfigFields($actions);
             $tmp['ACTIONS'] = $renderer->get();
         } else {
             if (sf_api_exists('VIEW', 'TableCellRenderer') == TRUE) {
                 $renderer = sf_api('VIEW', 'TableCellRenderer');
                 $renderer->setRendererConfig($item['renderer']);
                 $renderer->setConfigFields($item);
                 $tmp['ACTIONS'] = $renderer->get();
             } else {
                 $tmp['ACTIONS'] = '';
             }
         }
     }
     $this->tpl->setVariable($tmp);
     $this->tpl->parse('FOOTER_SELECT_MULTIPLE');
     unset($tmp);
 }