本文整理汇总了PHP中Protocol::details方法的典型用法代码示例。如果您正苦于以下问题:PHP Protocol::details方法的具体用法?PHP Protocol::details怎么用?PHP Protocol::details使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Protocol
的用法示例。
在下文中一共展示了Protocol::details方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
//.........这里部分代码省略.........
// 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');
$member->setLabel(parent::lang('class.ProtocolView#entry#form#member2') . ':');
$member->addRule('regex', parent::lang('class.ProtocolView#entry#rule#regexp.allowedChars') . ' [' . $_SESSION['GC']->get_config('text.desc') . ']', $_SESSION['GC']->get_config('text.regexp'));
// recorder
$recorder = $form->addElement('text', 'recorder');
$recorder->setLabel(parent::lang('class.ProtocolView#entry#form#recorder') . ':');
$recorder->addRule('required', parent::lang('class.ProtocolView#entry#rule#required.recorder'));
$recorder->addRule('regex', parent::lang('class.ProtocolView#entry#rule#regexp.allowedChars') . ' [' . $_SESSION['GC']->get_config('name.desc') . ']', $_SESSION['GC']->get_config('name.regexp'));
// protocol text
$protocolTA = $form->addElement('textarea', 'protocol');
$protocolTA->setLabel(parent::lang('class.ProtocolView#entry#form#protocol') . ':');
$protocolTA->addRule('regex', parent::lang('class.ProtocolView#entry#rule#regexp.allowedChars') . ' [' . $_SESSION['GC']->get_config('textarea.desc') . ']', $_SESSION['GC']->get_config('textarea.regexp'));
// js tiny_mce
$tmce = array('element' => 'protocol-0', 'css' => 'templates/protocols/tmce_' . $protocol->get_preset()->get_path() . '.css', 'transitem' => parent::lang('class.ProtocolView#new_entry#tmce#item'), 'transdecision' => parent::lang('class.ProtocolView#new_entry#tmce#decision'));
// smarty
$this->tpl->assign('tmce', $tmce);
// checkbox public
$public = $form->addElement('checkbox', 'public');
$public->setLabel(parent::lang('class.ProtocolView#entry#form#public') . ':');
// submit-button
$form->addElement('submit', 'submit', array('value' => parent::lang('class.ProtocolView#entry#form#submitButton')));
// validate
if ($form->validate()) {
// get form data
$data = $form->getValue();
// set owner
$data['owner'] = $protocol->get_owner();
// check $data['rights']
if (!isset($data['rights'])) {
$data['rights'] = array();
}
// merge with own groups, add admin
$data['rights'] = array_merge($data['rights'], $_SESSION['user']->get_groups(), array(1));
// add public access
$kPublicAccess = array_search(0, $data['rights']);
if ($kPublicAccess === false && isset($data['public']) && $data['public'] == 1) {
$data['rights'][] = 0;
} elseif ($kPublicAccess !== false && !isset($data['public'])) {
unset($data['rights'][$kPublicAccess]);
}
if (!isset($data['correctors'])) {
$data['correctors'] = array();
}
// get user and put to update
$correctionString = $data['correction'] . '|';
foreach ($data['correctors'] as $userid) {
$correctionString .= $userid . ',';
}
if (count($data['correctors']) > 0) {
$correctionString = substr($correctionString, 0, -1);
}
$protocolUpdate = array('date' => $data['date'], 'type' => $data['type'], 'location' => $data['location'], 'member' => $data['member0'] . '|' . $data['member1'] . '|' . $data['member2'], 'protocol' => $data['protocol'], 'preset' => new Preset($data['preset'], 'protocol', $protocol->get_id()), 'recorder' => $data['recorder'], 'correctable' => $correctionString, 'rights' => $data['rights'], 'owner' => $data['owner'], 'valid' => 1);
// update protocol
$protocol->update($protocolUpdate);
// write to db
$protocol->writeDb('update');
// smarty
$sCD = new JudoIntranetSmarty();
$sCD->assign('data', $protocol->details());
return $sCD->fetch('smarty.protocol.details.tpl');
} else {
return $form->render($renderer);
}
} else {
// error
$errno = $GLOBALS['Error']->error_raised('NotAuthorized', 'entry:' . $this->get('id'), $this->get('id'));
$GLOBALS['Error']->handle_error($errno);
return $GLOBALS['Error']->to_html($errno);
}
}