/** * @param array $args * @return string */ public function render($args = array()) { $code = $this->getMnemocode(); $itemMode = isset($args['item_mode']) ? $args['item_mode'] : 'teaser'; $listMode = isset($args['list_mode']) ? $args['list_mode'] : 'default'; $listClass = isset($args['list_class']) ? $args['list_class'] : "tao-list-{$code}"; $pagerTop = isset($args['pager_top']) ? $args['pager_top'] : false; $pagerBottom = isset($args['pager_bottom']) ? $args['pager_bottom'] : false; $count = $this->getCount($args); $items = $this->getItems($args); if ($count == 0) { $path = $this->viewPath("list-empty.phtml", $listMode); } else { $path = $this->viewPath("list.phtml", $listMode); } list($order, $filter, $groupBy, $nav, $fields, $other) = $this->convertArgs($args); if (isset($other['page']) && isset($other['per_page'])) { $pagerVar = $other['pager_var']; $page = (int) $other['page']; $perPage = (int) $other['per_page']; $numPages = ceil($count / $perPage); if ($numPages < 2) { $pagerTop = false; $pagerBottom = false; } } if (isset($args['ajax_url'])) { $ajaxUrl = $args['ajax_url']; } else { $ajaxUrl = '/local/vendor/techart/bitrix.tao/api/elements-ajax.php'; $urlArgs = $args; $urlArgs['infoblock'] = $this->getMnemocode(); $ajaxUrl = \TAO\Urls::url($ajaxUrl, $urlArgs); } ob_start(); include $path; $content = ob_get_clean(); return $content; }