コード例 #1
0
 public function render($componentId, $partialsConfig)
 {
     $partialClass = $partialsConfig['class'];
     $params = $partialsConfig['params'];
     $partial = new $partialClass($params);
     $ids = $partial->getIds();
     $number = 0;
     $count = count($ids);
     $ret = '';
     $helper = new Kwf_Component_View_Helper_Partial();
     $helper->setRenderer($this->_getRenderer());
     foreach ($ids as $id) {
         $config = array('id' => $id, 'class' => $partialClass, 'params' => $params, 'info' => array('total' => $count, 'number' => $number++));
         $content = $helper->partial($componentId, $config, $id, $partialsConfig['viewCacheEnabled']);
         if (isset($params['tpl'])) {
             $tpl = $params['tpl'];
         } else {
             $tpl = '{content}';
         }
         $ret .= str_replace(array('{id}', '{content}'), array($id, $content), $tpl);
     }
     if (empty($ids) && isset($params['noEntriesFound']) && $params['noEntriesFound']) {
         $ret .= '<span class="noEntriesFound">' . $params['noEntriesFound'] . '</span>';
     }
     return $ret;
 }
コード例 #2
0
 public function load($row, $info)
 {
     $primaryKeyValue = $row->id;
     $config = array('id' => $primaryKeyValue, 'class' => 'Kwf_Component_Partial_Id', 'params' => array('componentId' => $this->_componentId), 'info' => array('total' => $info['total'], 'number' => $info['number']));
     $renderer = new Kwf_Component_Renderer();
     $helper = new Kwf_Component_View_Helper_Partial();
     $helper->setRenderer($renderer);
     $ret = $helper->partial($this->_componentId, $config, $primaryKeyValue, true);
     return $renderer->render($ret);
 }