acp_styles::list_style PHP Method

list_style() protected method

Show item in styles list
protected list_style ( array &$style, integer $level )
$style array style row
$level integer style inheritance level
    protected function list_style(&$style, $level)
    {
        // Mark row as shown
        if (!empty($style['_shown'])) {
            return;
        }
        $style['_shown'] = true;
        // Generate template variables
        $actions = array();
        $row = array('STYLE_ID' => $style['style_id'], 'STYLE_NAME' => htmlspecialchars($style['style_name']), 'STYLE_PATH' => htmlspecialchars($style['style_path']), 'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']), 'STYLE_ACTIVE' => $style['style_active'], 'DEFAULT' => $style['style_id'] && $style['style_id'] == $this->default_style, 'USERS' => isset($style['_users']) ? $style['_users'] : '', 'LEVEL' => $level, 'PADDING' => 4 + 16 * $level, 'SHOW_COPYRIGHT' => $style['style_id'] ? false : true, 'STYLE_PATH_FULL' => htmlspecialchars($this->styles_path_absolute . '/' . $style['style_path']) . '/', 'COMMENT' => isset($style['_note']) ? $style['_note'] : '', 'EXTRA' => '', 'EXTRA_OPTIONS' => '');
        // Status specific data
        if ($style['style_id']) {
            // Style is installed
            // Details
            $actions[] = array('U_ACTION' => $this->u_action . '&action=details&id=' . $style['style_id'], 'L_ACTION' => $this->user->lang['DETAILS']);
            // Activate/Deactive
            $action_name = ($style['style_active'] ? 'de' : '') . 'activate';
            $actions[] = array('U_ACTION' => $this->u_action . '&action=' . $action_name . '&hash=' . generate_link_hash($action_name) . '&id=' . $style['style_id'], 'L_ACTION' => $this->user->lang['STYLE_' . ($style['style_active'] ? 'DE' : '') . 'ACTIVATE']);
            /*			// Export
              			$actions[] = array(
              				'U_ACTION'	=> $this->u_action . '&action=export&hash=' . generate_link_hash('export') . '&id=' . $style['style_id'],
              				'L_ACTION'	=> $this->user->lang['EXPORT']
              			); */
            // Uninstall
            $actions[] = array('U_ACTION' => $this->u_action . '&action=uninstall&hash=' . generate_link_hash('uninstall') . '&id=' . $style['style_id'], 'L_ACTION' => $this->user->lang['STYLE_UNINSTALL']);
            // Preview
            $actions[] = array('U_ACTION' => append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'style=' . $style['style_id']), 'L_ACTION' => $this->user->lang['PREVIEW']);
        } else {
            // Style is not installed
            if (empty($style['_available'])) {
                $actions[] = array('HTML' => $this->user->lang['CANNOT_BE_INSTALLED']);
            } else {
                $actions[] = array('U_ACTION' => $this->u_action . '&action=install&hash=' . generate_link_hash('install') . '&dir=' . urlencode($style['style_path']), 'L_ACTION' => $this->user->lang['INSTALL_STYLE']);
            }
        }
        // todo: add hook
        // Assign template variables
        $this->template->assign_block_vars('styles_list', $row);
        foreach ($actions as $action) {
            $this->template->assign_block_vars('styles_list.actions', $action);
        }
        // Increase counters
        $counter = $style['style_id'] ? $style['style_active'] ? 'active' : 'inactive' : (empty($style['_available']) ? 'cannotinstall' : 'caninstall');
        if (!isset($this->style_counters)) {
            $this->style_counters = array('total' => 0, 'active' => 0, 'inactive' => 0, 'caninstall' => 0, 'cannotinstall' => 0);
        }
        $this->style_counters[$counter]++;
        $this->style_counters['total']++;
    }