jPrefManager::getAllPreferences PHP Метод

getAllPreferences() публичный статический Метод

public static getAllPreferences ( $get_prefs_values = true )
    public static function getAllPreferences($get_prefs_values = true)
    {
        $preferences = self::_getPrefFile();
        $prefs = array();
        $nogroup = new jPrefItemGroup();
        $nogroup->id = '__nogroup';
        $nogroup->locale = 'jpref~prefs.group.others';
        foreach ($preferences as $item_key => $item) {
            if (substr($item_key, 0, 5) == 'group') {
                $g = new jPrefItemGroup();
                $g->setFromIniNode($item_key, $item);
                $prefs[$g->id] = $g;
            } elseif (substr($item_key, 0, 4) == 'pref') {
                $p = new jPrefItem();
                $p->setFromIniNode($item_key, $item);
                //current user doesnt have rights to read this pref
                if (!$p->isReadable()) {
                    continue;
                }
                if ($get_prefs_values) {
                    $p->loadValue();
                }
                if (!empty($p->group)) {
                    $prefs[$p->group]->prefs[] = $p;
                } else {
                    $nogroup->prefs[] = $p;
                }
            }
        }
        usort($prefs, 'jPrefItemGroup::compareGroup');
        if (count($nogroup->prefs) > 0) {
            $prefs['__nogroup'] = $nogroup;
        }
        return $prefs;
    }

Usage Example

Пример #1
0
 /**
  * 
  */
 public function index()
 {
     $rep = $this->getResponse('html');
     $tpl = new jTpl();
     $tpl->assign('prefs', jPrefManager::getAllPreferences());
     $rep->body->assign('MAIN', $tpl->fetch('prefs_index'));
     $rep->body->assign('selectedMenuItem', 'pref');
     return $rep;
 }