本文整理匯總了PHP中Group::setType方法的典型用法代碼示例。如果您正苦於以下問題:PHP Group::setType方法的具體用法?PHP Group::setType怎麽用?PHP Group::setType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Group
的用法示例。
在下文中一共展示了Group::setType方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: createGroup
/**
* Create a new group
* @return void
*/
private function createGroup()
{
if (isset($_POST) && is_array($_POST) && count($_POST) > 0) {
require_once FRAMEWORK_PATH . 'models/group.php';
$group = new Group($this->registry, 0);
$group->setCreator($this->registry->getObject('authenticate')->getUser()->getUserID());
$group->setName($this->registry->getObject('db')->sanitizeData($_POST['name']));
$group->setDescription($this->registry->getObject('db')->sanitizeData($_POST['description']));
$group->setType($_POST['type']);
$group->save();
$this->registry->errorPage('Group created', 'Thank you, your new group has been created');
} else {
$this->registry->getObject('template')->buildFromTemplates('header.tpl.php', 'groups/create.tpl.php', 'footer.tpl.php');
}
}
示例3: getSessionVar
public function getSessionVar()
{
$sessionVar = [];
$sql_select = "SELECT sessionName, varName, varValue, LastUpdate\n FROM sessionvar";
$stmt = $conn->query($sql_select);
$returnedList = $stmt->fetchAll();
if (count($returnedList) > 0) {
foreach ($returnedList as $group) {
$curGroup = new Group($group['group_name']);
$curGroup->setID($group['groupid']);
$curGroup->setType($group['group_type']);
$curGroup->setWeb($group['group_web']);
$listOfGroups[] = $curGroup;
}
}
return $listOfGroups;
}
示例4: body
protected function body()
{
$inputs = array('lecture' => 'isIndex', 'name' => 'isNotEmpty', 'description' => array());
if (!$this->isInputValid($inputs)) {
return false;
}
$lectureIndex = $this->getParams('lecture');
$groupName = $this->getParams('name');
$groupDescription = $this->getParams('description');
$public = $this->paramExists('public') ? 'public' : 'private';
$groupId = $this->getParams('id');
$editing = $groupId !== null && $groupId !== '';
$user = User::instance();
/** @var \Lecture $lecture */
$lecture = Repositories::findEntity(Repositories::Lecture, $lectureIndex);
if ($editing) {
/**
* @var $group \Group
*/
$group = Repositories::findEntity(Repositories::Group, $groupId);
$group->setName($groupName);
$group->setDescription($groupDescription);
$group->setType($public);
Repositories::persistAndFlush($group);
} else {
if (!$this->userHasPrivileges(User::groupsAdd)) {
return $this->death(StringID::InsufficientPrivileges);
}
$group = new \Group();
$group->setDeleted(false);
$group->setDescription($groupDescription);
$group->setLecture($lecture);
$group->setName($groupName);
$group->setOwner($user->getEntity());
$group->setType($public);
Repositories::persistAndFlush($group);
}
return true;
}
示例5: 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;
}
示例6: createImplicitGroup
/**
* @param $type
*/
private function createImplicitGroup($type)
{
$group = new Group();
$group->setType($type);
$group->addItem(array_pop($this->items));
$group->fromString(substr($this->expression, $this->parsePos), $this->value, $this->expressionClass);
$this->items[] = $group;
$this->parsePos = strlen($this->expression);
}
示例7: Template
case "show":
$groupings[$_GET['line']]->setVisible(true);
$groupings[$_GET["line"]]->rebuildElementLine();
$mustSave = true;
break;
case "edit":
$tpl_edit = new Template(TPL_FILE_LOCATION . 'groups_edit.tpl');
$tpl_edit->set('lang', $lang);
$tpl_edit->set('theGroup', $groupings[$_GET['line']]);
$tpl_edit->set('imagenames', $thenamelist);
$tpl_edit->set('config', $config);
$tpl_body->set('form', $tpl_edit);
break;
case "add":
$aGroup = new Group();
$aGroup->setType(trim($_POST["groupname"]));
$aGroup->setGroupImage(trim($_POST["imagename"]));
$aGroup->setVisible(true);
$aGroup->rebuildElementLine();
$groups->addElement($aGroup);
$mustSave = true;
break;
case "save":
$groupings[$_POST["line"]]->setType(trim($_POST["groupname"]));
$groupings[$_POST["line"]]->setGroupImage(trim($_POST["imagename"]));
$groupings[$_POST["line"]]->rebuildElementLine();
$mustSave = true;
break;
case "del":
$groups->deleteElement($_GET["line"]);
$mustSave = true;
示例8: addSubGroup
function addSubGroup($function, &$node, $instruction)
{
if ($this->fillclass == true) {
return;
}
if ($this->checkclass == true) {
return;
}
$rule = trim($instruction->getRule());
$rgid = trim($instruction->getRgid());
$endrgid = $this->findEndSubGroup($rgid);
if ($endrgid == "") {
//$this->addErrorMessage(Language::errorGroupMissingEndSubGroup());
return;
}
$group = explode(".", $rule);
if (sizeof($group) < 2 || trim($group[1]) == "") {
$this->addErrorMessage(Language::errorGroupTemplateNotFound());
return;
}
$this->groups[] = $rgid;
$this->groupsend[] = $endrgid;
$groupactions = $this->findStatementsInSubGroup($rgid);
//print_r($groupactions);
/* add these sub group actions to the top group, so we know they are part of the group structure! */
$current = $this->groupactions[end($this->realgroups)];
$this->groupactions[end($this->realgroups)] = array_merge($current, $groupactions);
$this->groupactions[$this->groups[sizeof($this->groups) - 1]] = $groupactions;
// add sub group function
$subgroupfunctionnode = $this->factory->method($function);
$subgroupfunctionnode->makePrivate();
// determine group
$groupnode = new PHPParser_Node_Scalar_String(trim($group[1]));
// get group actions and add statement
$args[] = new PHPParser_Node_Arg(new PHPParser_Node_Scalar_String(implode("~", $groupactions)));
$args[] = new PHPParser_Node_Arg($groupnode);
$stmt = new PHPParser_Node_Stmt_Return(new PHPParser_Node_Expr_MethodCall(new PHPParser_Node_Expr_Variable(VARIABLE_THIS), new PHPParser_Node_Name(array(FUNCTION_DO_SUBGROUP)), $args));
$subgroupfunctionnode->addStmt($stmt);
/* add subgroup doAction */
$node->addStmt($subgroupfunctionnode);
// add group to db if not exists yet
if (substr(trim($group[1]), 0, 1) != INDICATOR_FILL) {
$gr = $this->survey->getGroupByName(trim($group[1]));
if ($gr->getName() == "") {
$gr = new Group();
$gr->setSuid($this->suid);
$gr->setName(trim($group[1]));
$gr->setType(GROUP_SUB);
$gr->save();
}
}
// update overall counter
$this->cnt = $rgid;
// back to beginning of subgroup so we add any subquestions!
}
示例9: Group
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Add Group</title>
</head>
<body>
<form class="" action="add-group.php" method="post">
Group Name:
<input type="text" name="group_name" value=""><br>
Group Type:
<input type="text" name="group_type" value=""><br>
Website:
<input type="text" name="group_web" value=""><br>
<input type="submit" name="name" value="submit">
</form>
</body>
</html>
<?php
require 'conntodb.php';
include 'group-class.php';
if (!empty($_POST)) {
$group = new Group($_POST['group_name']);
$group->setType($_POST['group_type']);
$group->setWeb($_POST['group_web']);
$group->addToGroupTbl($conn);
}
示例10: retrieveGroupList
public static function retrieveGroupList($conn)
{
$listOfGroups;
$sql_select = "SELECT groupid, group_name, group_type, group_web, marked_for_deletion\n FROM group_tbl\n ORDER BY group_type";
$stmt = $conn->query($sql_select);
$returnedList = $stmt->fetchAll();
if (count($returnedList) > 0) {
foreach ($returnedList as $group) {
if ($group['marked_for_deletion'] == true) {
continue;
}
$curGroup = new Group($group['group_name']);
$curGroup->setID($group['groupid']);
$curGroup->setType($group['group_type']);
$curGroup->setWeb($group['group_web']);
$listOfGroups[] = $curGroup;
}
}
return $listOfGroups;
}