本文整理汇总了PHP中Unit::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP Unit::getList方法的具体用法?PHP Unit::getList怎么用?PHP Unit::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Unit
的用法示例。
在下文中一共展示了Unit::getList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_main
function do_main()
{
$this->oPage->setBreadcrumbDetails(_kt('select a unit'));
$this->oPage->setTitle(_kt("Unit Management"));
$unit_list =& Unit::getList();
$oTemplating =& KTTemplating::getSingleton();
$oTemplate = $oTemplating->loadTemplate("ktcore/principals/unitadmin");
$aTemplateData = array("context" => $this, "unit_list" => $unit_list);
return $oTemplate->render($aTemplateData);
}
示例2: form_addgroup
function form_addgroup()
{
$oForm = new KTForm();
$oForm->setOptions(array('identifier' => 'ktcore.groups.add', 'label' => _kt("Create a new group"), 'submit_label' => _kt("Create group"), 'action' => 'creategroup', 'fail_action' => 'addgroup', 'cancel_action' => 'main', 'context' => $this));
$oForm->setWidgets(array(array('ktcore.widgets.string', array('name' => 'group_name', 'label' => _kt("Group Name"), 'description' => _kt('A short name for the group. e.g. <strong>administrators</strong>.'), 'value' => null, 'required' => true)), array('ktcore.widgets.boolean', array('name' => 'sysadmin', 'label' => _kt("System Administrators"), 'description' => _kt('Should all the members of this group be given <strong>system</strong> administration privileges?'), 'value' => null))));
$oForm->setValidators(array(array('ktcore.validators.string', array('test' => 'group_name', 'output' => 'group_name')), array('ktcore.validators.boolean', array('test' => 'sysadmin', 'output' => 'sysadmin'))));
// if we have any units.
$aUnits = Unit::getList();
if (!PEAR::isError($aUnits) && !empty($aUnits)) {
$oForm->addWidgets(array(array('ktcore.widgets.entityselection', array('name' => 'unit', 'label' => _kt('Unit'), 'description' => _kt('Which Unit is this group part of?'), 'vocab' => $aUnits, 'label_method' => 'getName', 'simple_select' => false, 'unselected_label' => _kt("No unit"))), array('ktcore.widgets.boolean', array('name' => 'unitadmin', 'label' => _kt("Unit Administrators"), 'description' => _kt('Should all the members of this group be given <strong>unit</strong> administration privileges?'), 'important_description' => _kt("Note that its not possible to set a group without a unit as having unit administration privileges."), 'value' => null))));
$oForm->addValidators(array(array('ktcore.validators.entity', array('test' => 'unit', 'class' => 'Unit', 'output' => 'unit')), array('ktcore.validators.boolean', array('test' => 'unitadmin', 'output' => 'unitadmin'))));
}
return $oForm;
}