示例#1
0
 /**
  * Формирует HTML-pager
  *
  * @param Templates_HTML_Template $t
  * @param Data_Pagination_Pager   $pager
  * @param array                   $call
  * @param array                   $options
  *
  * @return string
  */
 public function pager(Templates_HTML_Template $t, Data_Pagination_Pager $pager, array $call, array $options = array())
 {
     $res = '';
     if (isset($options['info']) && $options['info']) {
         $res = $t->content_tag('div', sprintf('%d – %d / %d', $pager->current->first_item, $pager->current->last_item, $pager->num_of_items), array('class' => 'info'));
     }
     foreach ($pager->current->window(Core::if_not_set($options, 'padding', 10))->pages as $page) {
         $res .= $t->link_to(call_user_func_array(array($call[0], $call[1]), count($call) > 2 ? array_merge($call[2], array('page' => $page->number)) : array($page->number)), $page->number, array('class' => $page->number == $pager->current->number ? 'active' : ''));
     }
     return $t->content_tag('div', $res, array('class' => (isset($options['class']) ? $options['class'] . ' ' : '') . 'pager'));
 }
示例#2
0
文件: View.php 项目: techart/tao
 protected function get_helpers()
 {
     $helpers = parent::get_helpers();
     $this->load_helperes_from_cache($helpers);
     return $helpers;
 }
示例#3
0
文件: Forms.php 项目: techart/tao
 /**
  * @param Templates_HTML_Template $t
  * @param int $from
  * @param int $to
  * @param stirng $name
  * @param string $type
  * @param Time_DateTime $value
  * @param array $attributes
  * @param string $tag
  */
 private function datetime_tag($t, $from, $to, $name, $type, Time_DateTime $value, $attributes, $tag = 'select')
 {
     $res = $t->tag($tag, Core_Arrays::merge(array('name' => $this->field_name_for($name) . "[{$type}]", 'id' => $this->field_id_for($name) . "_{$type}"), isset($attributes[$type]) ? Core_Arrays::merge($attributes, (array) $attributes[$type]) : $attributes), false);
     if ($from !== null && $to !== null) {
         for ($i = $from; $i <= $to; $i++) {
             $res .= $t->content_tag('option', sprintf('%02d', $i), array('value' => $i, 'selected' => $value ? $value->{$type} == $i : false));
         }
     }
     $res .= "</{$tag}>";
     return $res;
 }