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


PHP Protocol::get_rights方法代码示例

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


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

示例1: edit

 /**
  * edit returns the protocoltext as html-string for the edit page
  * 
  * @param int $pid entry-id for protocol
  * @return string html-string with the protocoltext
  */
 private function edit($pid)
 {
     // check rights
     if (Rights::check_rights($pid, 'protocol', true)) {
         // pagecaption
         $this->tpl->assign('pagecaption', parent::lang('class.ProtocolView#page#caption#edit'));
         // get protocol-object
         $protocol = new Protocol($pid);
         // smarty-templates
         $sD = new JudoIntranetSmarty();
         // get rights
         $pRights = $protocol->get_rights()->get_rights();
         // check public access
         $kPublicAccess = array_search(0, $pRights);
         $publicAccess = false;
         if ($kPublicAccess !== false) {
             $publicAccess = true;
             unset($pRights[$kPublicAccess]);
         }
         // formular
         $form = new HTML_QuickForm2('editProtocol', 'post', array('name' => 'editProtocol', 'action' => 'protocol.php?id=edit&pid=' . $pid));
         // get correction status and correctors
         $correctable = $protocol->get_correctable(false);
         $datasource = array('date' => $protocol->get_date('Y-m-d'), 'type' => $protocol->get_type('i'), 'location' => $protocol->get_location(), 'member0' => $protocol->get_member(false, 0), 'member1' => $protocol->get_member(false, 1), 'member2' => $protocol->get_member(false, 2), 'protocol' => $protocol->get_protocol(), 'preset' => $protocol->get_preset()->get_id(), 'recorder' => $protocol->get_recorder(), 'correction' => $correctable['status'], 'correctors' => $correctable['correctors']);
         // add public access
         if ($publicAccess) {
             $datasource['public'] = 1;
         }
         // add datasource
         $form->addDataSource(new HTML_QuickForm2_DataSource_Array($datasource));
         // renderer
         $renderer = HTML_QuickForm2_Renderer::factory('default');
         $renderer->setOption('required_note', parent::lang('class.ProtocolView#entry#form#requiredNote'));
         // elements
         // correction
         // radio
         $radio0 = $form->addElement('radio', 'correction', array('value' => 0));
         $radio0->setContent(parent::lang('class.ProtocolView#entry#form#correctionInWork'));
         $radio0->setLabel(parent::lang('class.ProtocolView#entry#form#correction') . ':');
         $radio1 = $form->addElement('radio', 'correction', array('value' => 1));
         $radio1->setContent(parent::lang('class.ProtocolView#entry#form#correctionCorrect'));
         $radio2 = $form->addElement('radio', 'correction', array('value' => 2));
         $radio2->setContent(parent::lang('class.ProtocolView#entry#form#correctionFinished'));
         // select correctors
         // get all users and put id and name to options
         $users = $_SESSION['user']->return_all_users(array($_SESSION['user']->get_userinfo('username')));
         $options = array();
         foreach ($users as $user) {
             $options[$user->get_userinfo('id')] = $user->get_userinfo('name');
         }
         $correctors = $form->addElement('select', 'correctors', array('multiple' => 'multiple', 'size' => 5));
         $correctors->setLabel(parent::lang('class.ProtocolView#entry#form#correctors') . ':');
         $correctors->loadOptions($options);
         // preset
         $options = array(0 => '--') + Preset::read_all_presets('protocol');
         $preset = $form->addElement('select', 'preset');
         $preset->setLabel(parent::lang('class.ProtocolView#entry#form#preset') . ':');
         $preset->loadOptions($options);
         $preset->addRule('required', parent::lang('class.ProtocolView#entry#rule#required.preset'));
         $preset->addRule('callback', parent::lang('class.ProtocolView#entry#rule#check.select'), array($this, 'callback_check_select'));
         // date
         $date = $form->addElement('text', 'date', array());
         $date->setLabel(parent::lang('class.ProtocolView#entry#form#date') . ':');
         // rule
         $date->addRule('required', parent::lang('class.ProtocolView#entry#rule#required.date'));
         $date->addRule('callback', parent::lang('class.ProtocolView#entry#rule#check.date'), array($this, 'callback_check_date'));
         // add jquery-datepicker
         // smarty
         $sD->assign('elementid', 'date-0');
         $sD->assign('dateFormat', 'yy-mm-dd');
         $sD->assign('dateValue', $protocol->get_date('y-m-d'));
         $this->add_jquery($sD->fetch('smarty.js-datepicker.tpl'));
         // type
         $options = array_merge(array(0 => '--'), Protocol::return_types());
         $type = $form->addElement('select', 'type');
         $type->setLabel(parent::lang('class.ProtocolView#entry#form#type') . ':');
         $type->loadOptions($options);
         $type->addRule('required', parent::lang('class.ProtocolView#entry#rule#required.type'));
         $type->addRule('callback', parent::lang('class.ProtocolView#entry#rule#check.select'), array($this, 'callback_check_select'));
         // location
         $location = $form->addElement('text', 'location');
         $location->setLabel(parent::lang('class.ProtocolView#entry#form#location') . ':');
         $location->addRule('required', parent::lang('class.ProtocolView#entry#rule#required.location'));
         $location->addRule('regex', parent::lang('class.ProtocolView#entry#rule#regexp.allowedChars') . ' [' . $_SESSION['GC']->get_config('name.desc') . ']', $_SESSION['GC']->get_config('name.regexp'));
         // member0
         $member = $form->addElement('text', 'member0');
         $member->setLabel(parent::lang('class.ProtocolView#entry#form#member0') . ':');
         $member->addRule('regex', parent::lang('class.ProtocolView#entry#rule#regexp.allowedChars') . ' [' . $_SESSION['GC']->get_config('text.desc') . ']', $_SESSION['GC']->get_config('text.regexp'));
         // member1
         $member = $form->addElement('text', 'member1');
         $member->setLabel(parent::lang('class.ProtocolView#entry#form#member1') . ':');
         $member->addRule('regex', parent::lang('class.ProtocolView#entry#rule#regexp.allowedChars') . ' [' . $_SESSION['GC']->get_config('text.desc') . ']', $_SESSION['GC']->get_config('text.regexp'));
         // member2
         $member = $form->addElement('text', 'member2');
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:judointranet,代码行数:101,代码来源:class.ProtocolView.php


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