本文整理汇总了PHP中Groups::addElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Groups::addElement方法的具体用法?PHP Groups::addElement怎么用?PHP Groups::addElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Groups
的用法示例。
在下文中一共展示了Groups::addElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpGroups
function setUpGroups($lang)
{
if (!file_exists(GROUP_FILE_LOCATION)) {
$aGroupDB = new Groups();
$aGroupDB->setFileName(GROUP_FILE_LOCATION);
$names = ImageTypes::getMenuNames();
foreach ($names as $name) {
$aGroup = new Group();
$aGroup->setType($lang[$name]);
$aGroup->setGroupImage($name);
$aGroup->rebuildElementLine();
$aGroupDB->addElement($aGroup);
}
$aGroupDB->save();
} else {
// validate we have all the default groups
$addedElement = false;
$aGroupDB = new Groups(GROUP_FILE_LOCATION);
$names = ImageTypes::getMenuNames();
foreach ($names as $name) {
if ($aGroupDB->getAGroup($name) == "") {
$aGroup = new Group();
$aGroup->setType($lang[$name]);
$aGroup->setGroupImage($name);
$aGroup->rebuildElementLine();
$aGroupDB->addElement($aGroup);
$addedElement = true;
}
}
if ($addedElement) {
$aGroupDB->save();
}
}
}
示例2: Groups
function &getTypedGroups($reload = false)
{
if (isset($this->typedGroups) && !$reload) {
if ($this->typedGroups->hasFileChanged()) {
$reload = true;
}
}
if (!isset($this->typedGroups) || $reload) {
$_SESSION['load_count'] += 1;
$groupsinstance = new Groups();
$names = ImageTypes::getModuleNames();
foreach ($names as $name) {
$aGroup = new Group();
$aGroup->setType($this->lang[$name]);
$aGroup->setGroupImage($name);
$aGroup->rebuildElementLine();
$groupsinstance->addElement($aGroup);
}
$this->typedGroups =& $groupsinstance;
}
return $this->typedGroups;
}