当前位置: 首页>>代码示例>>PHP>>正文


PHP CustomField::getRights方法代码示例

本文整理汇总了PHP中CustomField::getRights方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomField::getRights方法的具体用法?PHP CustomField::getRights怎么用?PHP CustomField::getRights使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CustomField的用法示例。


在下文中一共展示了CustomField::getRights方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add

 public function add()
 {
     $isSent = Request::get(1, VAR_URI) == 'send';
     $this->breadcrumb->add('Hinzufügen');
     $this->header();
     $_positions = $this->getPositions();
     $positions = Core::constructObjectArray($_positions);
     $_fieldTypes = $this->getFieldTypes();
     $fieldTypes = Core::constructObjectArray($_fieldTypes);
     $data = array('name' => '', 'description' => '', 'internal' => '', 'priority' => 0, 'position' => reset($_positions), 'type' => reset($_fieldTypes), 'read' => array(), 'write' => array());
     foreach (CustomField::getRights() as $right) {
         foreach (array('read', 'write') as $type) {
             $data[$type][$right] = 1;
         }
     }
     $error = array();
     if ($isSent) {
         // Base options for every field
         $options = array_merge($this->getValidator(), array('internal' => array(Validator::OPTIONAL => true, Validator::MULTIPLE => array(array(Validator::MESSAGE => 'Der interne Name enthält Zeichen die nicht erlaubt sind. Erlaubt sind: a-z, 0-9, _, -', Validator::REGEXP => Validator::RE_URI, Validator::OPTIONAL => true), array(Validator::MESSAGE => 'Der interne Name darf maximal 32 Zeichen lang sein.', Validator::MAX_LENGTH => 32), array(Validator::MESSAGE => 'Der interne Name existiert bereits für eine anderes Feld der Tabelle.', Validator::CLOSURE => function ($internal) use(&$_positions) {
             if (!empty($internal)) {
                 $db = Database::getObject();
                 $db->query("SELECT id FROM <p>fields WHERE internal = <internal> AND position IN(<_positions:string[]>)", compact("internal", "_positions"));
                 return $db->numRows() == 0;
             }
             return true;
             // If nothing is specified we will generate a valid name
         }))), 'position' => array(Validator::MESSAGE => 'Der Anzeigeort ist ungültig.', Validator::LIST_CS => $_positions), 'type' => array(Validator::MESSAGE => 'Der Feldtyp ist ungültig.', Validator::LIST_CS => $_fieldTypes)));
         // get additional options for the specified field
         $type = Request::get('type');
         if (isset($fieldTypes[$type])) {
             $options = array_merge($options, $fieldTypes[$type]->getValidationParams(true));
         }
         extract(Validator::checkRequest($options));
         if (count($error) == 0) {
             $field = $fieldTypes[$data['type']];
             $this->injectDataToField($field, $data);
             if ($field->create()) {
                 CmsPage::ok("Das Feld wurde erfolgreich angelegt.");
             } else {
                 $error[] = 'Das Feld konnt leider nicht angelegt werden.';
             }
         }
         if (count($error) > 0) {
             CmsPage::error($error);
         }
     }
     if (!$isSent || count($error) > 0) {
         $tpl = Response::getObject()->appendTemplate("/Cms/admin/fields_add");
         $tpl->assign('positions', $positions, false);
         $tpl->assign('types', $fieldTypes, false);
         $tpl->assign('data', $data, false);
         $tpl->assign('baseUri', $this->getBaseURI());
         $tpl->output();
     }
     $this->footer();
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:56,代码来源:class.AdminFieldPages.php

示例2: ensurePermissionsValid

 public static function ensurePermissionsValid($permissions)
 {
     $data = array();
     foreach (CustomField::getRights() as $right) {
         foreach (array('read', 'write') as $type) {
             if (empty($permissions[$type][$right])) {
                 $data[$type][$right] = 0;
             } else {
                 $data[$type][$right] = 1;
             }
         }
     }
     return $data;
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:14,代码来源:class.CustomField.php


注:本文中的CustomField::getRights方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。