本文整理汇总了PHP中Group::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::getName方法的具体用法?PHP Group::getName怎么用?PHP Group::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group
的用法示例。
在下文中一共展示了Group::getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testName
public function testName()
{
$testName = "TEST_GROUP_2";
$this->assertEquals($this::TEST_GROUP, $this->group->getName());
$this->group->setName($testName);
$this->assertEquals($testName, $this->group->getName());
}
示例2: tearDown
protected function tearDown()
{
$user = $this->userRepository->findOneBy(["email" => $this->user->getEmail()]);
$group = $this->groupRepository->findOneBy(["name" => $this->group->getName()]);
if (!empty($user)) {
$this->entityManager->remove($user);
}
if (!empty($group)) {
$this->entityManager->remove($group);
}
$this->entityManager->flush();
}
示例3: display
public static function display()
{
if (!is_numeric($_GET['id'])) {
cc_redirect(Admin::link('users'));
}
if ($_POST['cc_form'] == 'edit-group') {
$id = $_GET['id'];
$previous = (array) unserialize(urldecode($_POST['previous']));
$group = $_POST['group'];
$permissions = (array) $_POST['permissions'];
$new = array_merge($previous, $permissions);
foreach ($new as $k => $v) {
if ($v == "1") {
$new[$k] = true;
}
if (!array_key_exists($k, $permissions)) {
$new[$k] = false;
}
}
if (DB::update('users', array('name', 'data'), array($group, serialize(filter('admin_edit_group_data', array('permissions' => $new)))), array('users_id = ?', $id))) {
$message = Message::success(__('admin', 'group-information-updated'));
} else {
$message = Message::error(__('admin', 'database-error'));
}
}
$p = Permissions::getAll();
$g = new Group((int) $_GET['id']);
$p_form = new Form('');
$p_form->setCC_Form('edit-group');
$p_form->startFieldset(__('admin', 'group-information'));
$p_form->addInput(__('admin', 'group-name'), 'text', 'group', $g->getName());
$p_form->endFieldset();
$p_form->addHTML(sprintf("<h3>%s</h3>", __('admin', 'permissions')));
$p_table = new Table('permissions');
$p_table->addHeader(array('Name', 'Allowed'));
foreach ($p as $k => $v) {
$previous[$v['name']] = $g->isAllowed($v['name']);
$p_table->addRow(array(__('permissions', $v['name']), sprintf('<input type="checkbox" name="permissions[%s]"%svalue="1"/>', $v['name'], $g->isAllowed($v['name']) ? ' checked="checked"' : '')));
}
$p_form->addHidden('previous', urlencode(serialize($previous)));
$p_form->addHTML($p_table->html());
$p_form->addSubmit('', 'save-permissions', __('admin', 'save-changes'));
return array(sprintf('%s: %s', __('admin', 'edit-group'), $g->getName()), $message . $p_form->html());
}
示例4: plugin_init_escalation
function plugin_init_escalation()
{
global $PLUGIN_HOOKS, $CFG_GLPI;
$PLUGIN_HOOKS['change_profile']['escalation'] = array('PluginEscalationProfile', 'changeprofile');
$PLUGIN_HOOKS['csrf_compliant']['escalation'] = true;
// After escalation, if user can't see the ticket (dan't see all ticket right), it redirect to ticket list
if (isset($_SERVER['HTTP_REFERER']) and strstr($_SERVER['HTTP_REFERER'], "escalation/front/group_group.form.php")) {
if (isset($_GET['id'])) {
$ticket = new Ticket();
$ticket->getFromDB($_GET['id']);
if (!$ticket->canViewItem()) {
// Can't see ticket, go in ticket list
$ticket->redirectToList();
}
}
}
if (isset($_SESSION["glpiID"])) {
$plugin = new Plugin();
if ($plugin->isActivated('escalation')) {
Plugin::registerClass('PluginEscalationProfile', array('addtabon' => array('Profile')));
Plugin::registerClass('PluginEscalationTicketCopy', array('addtabon' => array('Ticket')));
Plugin::registerClass('PluginEscalationConfig', array('addtabon' => array('Entity')));
Plugin::registerClass('PluginEscalationGroup_Group', array('addtabon' => array('Ticket', 'Group')));
$PLUGIN_HOOKS['menu_entry']['escalation'] = false;
PluginEscalationGroup_Group::convertNewTicket();
// limit group
$peConfig = new PluginEscalationConfig();
if ($peConfig->getValue('limitgroup', $_SESSION['glpidefault_entity']) == '1') {
if (strpos($_SERVER['PHP_SELF'], "ticket.form.php") && !isset($_GET['id'])) {
$group = new Group();
$a_groups = array();
$a_groups[0] = Dropdown::EMPTY_VALUE;
foreach ($_SESSION['glpigroups'] as $groups_id) {
$group->getFromDB($groups_id);
$a_groups[$groups_id] = $group->getName();
}
$_SESSION['plugin_escalation_requestergroups'] = $a_groups;
register_shutdown_function('plugin_escalation_on_exit');
ob_start();
}
}
// end limit group
}
$PLUGIN_HOOKS['pre_item_add']['escalation'] = array('Ticket' => array('PluginEscalationGroup_Group', 'selectGroupOnAdd'));
$PLUGIN_HOOKS['item_add']['escalation'] = array('Ticket' => array('PluginEscalationTicketCopy', 'finishAdd'));
// $PLUGIN_HOOKS['pre_item_update']['escalation'] = array('Ticket' => array('PluginEscalationGroup_Group', 'notMultiple'));
}
}
示例5: pdfForGroup
static function pdfForGroup(PluginPdfSimplePDF $pdf, Group $group, $tree)
{
global $DB, $CFG_GLPI;
$used = array();
$ids = array();
// Retrieve member list
$entityrestrict = Group_User::getDataForGroup($group, $used, $ids, '', $tree);
$title = "<b>" . sprintf(__('%1$s (%2$s)'), _n('User', 'Users', 2) . "</b>", __('D=Dynamic'));
$number = count($used);
if ($number > $_SESSION['glpilist_limit']) {
$title = sprintf(__('%1$s (%2$s)'), $title, $_SESSION['glpilist_limit'] . "/" . $number);
} else {
$title = sprintf(__('%1$s (%2$s)'), $title, $number);
}
$pdf->setColumnsSize(100);
$pdf->displayTitle($title);
if ($number) {
$user = new User();
$group = new Group();
if ($tree) {
$pdf->setColumnsSize(35, 45, 10, 10);
$pdf->displayTitle(User::getTypeName(1), Group::getTypeName(1), __('Manager'), __('Delegatee'));
} else {
$pdf->setColumnsSize(60, 20, 20);
$pdf->displayTitle(User::getTypeName(1), __('Manager'), __('Delegatee'));
}
for ($i = 0; $i < $number && $i < $_SESSION['glpilist_limit']; $i++) {
$data = $used[$i];
$name = Html::clean(getUserName($data["id"]));
if ($data["is_dynamic"]) {
$name = sprintf(__('%1$s (%2$s)'), $name, '<b>' . __('D') . '</b>');
}
if ($tree) {
$group->getFromDB($data["groups_id"]);
$pdf->displayLine($name, $group->getName(), Dropdown::getYesNo($data['is_manager']), Dropdown::getYesNo($data['is_userdelegate']));
} else {
$pdf->displayLine($name, Dropdown::getYesNo($data['is_manager']), Dropdown::getYesNo($data['is_userdelegate']));
}
}
} else {
$pdf->setColumnsAlign('center');
$pdf->displayLine(__('No item found'));
}
$pdf->displaySpace();
}
示例6: getWeeklyReport
/**
* Returns the data used by the weekly report.
*
* @param string $usr_id The ID of the user this report is for.
* @param int $prj_id The project id
* @param string|DateTime $start The start date of this report.
* @param string|DateTime $end The end date of this report.
* @param array $options extra options for report:
* - $separate_closed If closed issues should be separated from other issues.
* - $ignore_statuses If issue status changes should be ignored in report.
* - $separate_not_assigned_to_user Separate Issues Not Assigned to User
* - $show_per_issue Add time spent on issue to issues
* - $separate_no_time Separate No time spent issues
* @return array An array of data containing all the elements of the weekly report.
*/
public static function getWeeklyReport($usr_id, $prj_id, $start, $end, $options = array())
{
// figure out timezone
$user_prefs = Prefs::get($usr_id);
$tz = $user_prefs['timezone'];
// if start or end is string, convert assume min and max date are specified
if (!$start instanceof DateTime) {
$start = Date_Helper::getDateTime($start, $tz)->setTime(0, 0, 0);
}
if (!$end instanceof DateTime) {
$end = Date_Helper::getDateTime($end, $tz)->setTime(23, 59, 59);
}
$start_ts = Date_Helper::getSqlDateTime($start);
$end_ts = Date_Helper::getSqlDateTime($end);
$time_tracking = Time_Tracking::getSummaryByUser($usr_id, $prj_id, $start_ts, $end_ts);
// replace spaces in index with _ and calculate total time
$total_time = 0;
foreach ($time_tracking as $category => $data) {
unset($time_tracking[$category]);
$time_tracking[str_replace(' ', '_', $category)] = $data;
$total_time += $data['total_time'];
}
// get count of issues assigned in week of report.
$stmt = 'SELECT
COUNT(*)
FROM
{{%issue}},
{{%issue_user}},
{{%status}}
WHERE
iss_id = isu_iss_id AND
iss_sta_id = sta_id AND
isu_usr_id = ? AND
iss_prj_id = ? AND
isu_assigned_date BETWEEN ? AND ?';
$params = array($usr_id, Auth::getCurrentProject(), $start_ts, $end_ts);
try {
$newly_assigned = DB_Helper::getInstance()->getOne($stmt, $params);
} catch (DbException $e) {
$newly_assigned = null;
}
$email_count = array('associated' => Support::getSentEmailCountByUser($usr_id, $start_ts, $end_ts, true), 'other' => Support::getSentEmailCountByUser($usr_id, $start_ts, $end_ts, false));
$htt_exclude = array();
if (!empty($options['ignore_statuses'])) {
$htt_exclude[] = 'status_changed';
$htt_exclude[] = 'status_auto_changed';
$htt_exclude[] = 'remote_status_change';
}
$issue_list = History::getTouchedIssuesByUser($usr_id, $prj_id, $start_ts, $end_ts, $htt_exclude);
$issues = array('no_time' => array(), 'not_mine' => array(), 'closed' => array(), 'other' => array());
// organize issues into categories
if ($issue_list) {
if (!empty($options['show_per_issue']) || !empty($options['separate_no_time'])) {
Time_Tracking::fillTimeSpentByIssueAndTime($issue_list, $usr_id, $start_ts, $end_ts);
}
foreach ($issue_list as $row) {
if (!empty($row['iss_customer_id']) && CRM::hasCustomerIntegration($row['iss_prj_id'])) {
$row['customer_name'] = CRM::getCustomerName($row['iss_prj_id'], $row['iss_customer_id']);
} else {
$row['customer_name'] = null;
}
if (!empty($options['separate_closed']) && $row['sta_is_closed'] == 1) {
$issues['closed'][] = $row;
} elseif (!empty($options['separate_not_assigned_to_user']) && !Issue::isAssignedToUser($row['iss_id'], $usr_id)) {
$issues['not_mine'][] = $row;
} elseif (!empty($options['separate_no_time']) && empty($row['it_spent'])) {
$issues['no_time'][] = $row;
} else {
$issues['other'][] = $row;
}
}
$sort_function = function ($a, $b) {
return strcasecmp($a['customer_name'], $b['customer_name']);
};
usort($issues['closed'], $sort_function);
usort($issues['other'], $sort_function);
}
return array('start' => $start_ts, 'end' => $end_ts, 'user' => User::getDetails($usr_id), 'group_name' => Group::getName(User::getGroupID($usr_id)), 'issues' => $issues, 'status_counts' => History::getTouchedIssueCountByStatus($usr_id, $prj_id, $start_ts, $end_ts), 'new_assigned_count' => $newly_assigned, 'time_tracking' => $time_tracking, 'email_count' => $email_count, 'phone_count' => Phone_Support::getCountByUser($usr_id, $start_ts, $end_ts), 'note_count' => Note::getCountByUser($usr_id, $start_ts, $end_ts), 'total_time' => Misc::getFormattedTime($total_time, false));
}
示例7: getAddEditForm
public static function getAddEditForm($target = '/admin/User')
{
$form = new Form('group_addedit', 'POST', $target, '', array('class' => 'admin'));
if (@$_REQUEST['id']) {
$group = new Group($_REQUEST['id']);
$form->setConstants(array('id' => $_REQUEST['id']));
$form->addElement('hidden', 'id');
} else {
$group = new Group();
}
$form->setConstants(array('section' => 'groupsaddedit'));
$form->addElement('hidden', 'section');
$form->addElement('text', 'name', 'Group Name');
$form->addElement('submit', 'submit', 'Save');
$form->addElement('reset', 'cancel', 'Cancel');
$defaultValues['name'] = $group->getName();
$form->setDefaults($defaultValues);
if ($form->validate() && isset($_REQUEST['submit'])) {
$group->setName($_REQUEST['name']);
$group->save();
}
return $form;
}
示例8: hasGroup
/**
* Returns whether the Schema has the given Group or not.
*
* @param Group $group
*
* @return bool
*/
public function hasGroup(Group $group)
{
return array_key_exists($group->getName(), $this->groups);
}
示例9: testSetName
/**
* @todo Implement testSetName().
*/
public function testSetName()
{
$this->object->setName('testgroup');
$this->assertEquals($this->object->getName(), 'testgroup');
}
示例10: Group
</span>
<span class="badge" style="width: 30px" data-toggle="tooltip" data-placement="right" title="Number of lines passed through the filter"><?php
echo $number_of_lines;
?>
</span>
</div>
</td>
<td class="description"><?php
echo $dashboard->prepareDescription();
?>
</td>
<td>
<?php
try {
$dashboard_s_group = new Group($dashboard->getGroupId());
echo $dashboard_s_group->getName();
} catch (fNotFoundException $e) {
echo "No group found";
}
?>
</td>
<td><?php
echo $dashboard->prepareColumns();
?>
</td>
<td><?php
echo $dashboard->prepareBackgroundColor();
?>
</td>
<td>
<a href="<?php
示例11: showForm
//.........这里部分代码省略.........
echo '<div id="block_requester_group" style="display:none">';
Group::dropdown(array('name' => 'actor_value_group'));
echo '</div>';
echo '<div id="block_requester_question_user" style="display:none">';
Dropdown::showFromArray('actor_value_question_person', $questions_user_list, array('value' => $this->fields['due_date_question']));
echo '</div>';
echo '<div id="block_requester_question_group" style="display:none">';
Dropdown::showFromArray('actor_value_question_group', $questions_group_list, array('value' => $this->fields['due_date_question']));
echo '</div>';
echo '<div>';
echo __('Email followup');
Dropdown::showYesNo('use_notification', 1);
echo '</div>';
echo '<p align="center">';
echo '<input type="hidden" name="id" value="' . $this->getID() . '" />';
echo '<input type="hidden" name="actor_role" value="requester" />';
echo '<input type="submit" value="' . __('Add') . '" class="submit_button" />';
echo '</p>';
echo "<hr>";
Html::closeForm();
// => List of saved requesters
foreach ($actors['requester'] as $id => $values) {
echo '<div>';
switch ($values['actor_type']) {
case 'creator':
echo $img_user . ' <b>' . __('Form requester', 'formcreator') . '</b>';
break;
case 'validator':
echo $img_user . ' <b>' . __('Form validator', 'formcreator') . '</b>';
break;
case 'person':
$user = new User();
$user->getFromDB($values['actor_value']);
echo $img_user . ' <b>' . __('User') . ' </b> "' . $user->getName() . '"';
break;
case 'question_person':
$question = new PluginFormcreatorQuestion();
$question->getFromDB($values['actor_value']);
echo $img_user . ' <b>' . __('Person from the question', 'formcreator') . '</b> "' . $question->getName() . '"';
break;
case 'group':
$group = new Group();
$group->getFromDB($values['actor_value']);
echo $img_user . ' <b>' . __('Group') . ' </b> "' . $group->getName() . '"';
break;
case 'question_group':
$question = new PluginFormcreatorQuestion();
$question->getFromDB($values['actor_value']);
echo $img_group . ' <b>' . __('Group from the question', 'formcreator') . '</b> "' . $question->getName() . '"';
break;
}
echo $values['use_notification'] ? ' ' . $img_mail . ' ' : ' ' . $img_nomail . ' ';
echo self::getDeleteImage($id);
echo '</div>';
}
echo '</td>';
// Observer
echo '<td valign="top">';
// => Add observer form
echo '<form name="form_target" id="form_add_watcher" method="post" style="display:none" action="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/front/targetticket.form.php">';
Dropdown::showFromArray('actor_type', array('' => Dropdown::EMPTY_VALUE, 'creator' => __('Form requester', 'formcreator'), 'validator' => __('Form validator', 'formcreator'), 'person' => __('Specific person', 'formcreator'), 'question_person' => __('Person from the question', 'formcreator'), 'group' => __('Specific group', 'formcreator'), 'question_group' => __('Group from the question', 'formcreator')), array('on_change' => 'formcreatorChangeActorWatcher(this.value)'));
echo '<div id="block_watcher_user" style="display:none">';
User::dropdown(array('name' => 'actor_value_person', 'right' => 'all', 'all' => 0));
echo '</div>';
echo '<div id="block_watcher_group" style="display:none">';
Group::dropdown(array('name' => 'actor_value_group'));
示例12: array
$p->addTab("tablaunch", _T("Launch Actions", 'msc'), "", "modules/msc/msc/launch.php", array('uuid'=>$machine->uuid, 'hostname'=>$machine->hostname));
$p->addTab("tabbundle", _T("Launch Bundle", 'msc'), "", "modules/msc/msc/launch_bundle.php", array('uuid'=>$machine->uuid, 'hostname'=>$machine->hostname));
$p->addTab("tablogs", _T("Logs", 'msc'), "", "modules/msc/msc/logs.php", array('uuid'=>$machine->uuid, 'hostname'=>$machine->hostname));
$p->addTab("tabhistory", _T("History", 'msc'), "", "modules/msc/msc/history.php", array('uuid'=>$machine->uuid, 'hostname'=>$machine->hostname));
$p->display();
}
} elseif ($_GET['gid']) {
$p = new TabbedPageGenerator();
$p->setSideMenu($sidemenu);
require("modules/dyngroup/includes/includes.php");
$group = new Group($_GET['gid'], true, true);
if ($group->exists == False) {
$msc_host = new RenderedMSCGroupDontExists($_GET['gid']);
$msc_host->headerDisplay();
} else {
$p->addTop(sprintf(_T("%s's group secure control", 'msc'), $group->getName()), "modules/msc/msc/header.php");
if (!$group->all_params['ro']) {
$p->addTab("grouptablaunch", _T("Launch Actions", 'msc'), "", "modules/msc/msc/launch.php", array('gid'=>$_GET['gid']));
$p->addTab("grouptabbundle", _T("Launch Bundle", 'msc'), "", "modules/msc/msc/launch_bundle.php", array('gid'=>$_GET['gid']));
}
$p->addTab("grouptablogs", _T("Logs", 'msc'), "", "modules/msc/msc/logs.php", array('gid'=>$_GET['gid']));
$p->addTab("grouptabhistory", _T("History", 'msc'), "", "modules/msc/msc/history.php", array('gid'=>$_GET['gid']));
}
$p->display();
} else {
$p = new PageGenerator();
$p->setSideMenu($sidemenu);
$p->display();
print _T("Not enough informations", "msc");
}
示例13: getName
/**
* Return display name property. (readonly)
*
* @author KnowledgeTree Team
* @access public
* @return string
*/
public function getName()
{
return $this->group->getName();
}
示例14: actionSaveGroup
function actionSaveGroup($currentUser)
{
$backUrl = $this->context->getFlowScopeAttr("backUrl");
$group = new Group();
$groupErrs = array();
$group->setId($this->context->getRequestAttr("id"));
$group->setName($this->context->getRequestAttr("name"));
if (!is_null($group->getName())) {
$group->setName(trim($group->getName()));
if (strlen($group->getName()) < 1) {
$group->setName(null);
}
}
if (is_null($group->getName())) {
$groupErrs["name"] = "field.error.empty";
}
$group->setDescription($this->context->getRequestAttr("description"));
if (!is_null($group->getDescription())) {
$group->setDescription(trim($group->getDescription()));
if (strlen($group->getDescription()) < 1) {
$group->setDescription(null);
}
}
$projects = $this->context->getRequestAttr("projects");
if (!is_null($projects)) {
$projects = json_encode($projects);
$group->setProjects($projects);
} else {
$group->setProjects(json_encode(array()));
}
$timeZone = new DateTimeZone("Europe/Vilnius");
$time = new DateTime("now", $timeZone);
$group->setOwner($currentUser->getId());
$group->setR_date($time->format("Y-m-d H:i:s"));
$group->setR_user($currentUser->getId());
$this->context->setFlashScopeAttr("group", $group);
$this->context->setFlashScopeAttr("groupErrs", $groupErrs);
if (count($groupErrs) >= 1) {
if (!is_null($backUrl)) {
header("Location: " . $backUrl);
return true;
}
return false;
}
$store = $this->storeGroup($group);
if (!$store) {
if (!is_null($backUrl)) {
header("Location: " . $backUrl);
return true;
}
return false;
}
$this->context->setRequestScopeAttr("success", "groups.success.stored");
$this->context->setFlashScopeAttr("viewGroup", $group);
$this->cancelGroupEdit();
if (!is_null($backUrl)) {
header("Location: " . $backUrl);
return true;
}
return false;
}
示例15: RenderedMSCGroupDontExists
# TODO need to use a generic widget!
$msc_host = new RenderedMSCGroupDontExists($_GET['gid']);
$msc_host->headerDisplay();
} else {
$ret = xmlrpc_getProfileSynchroState($params['target_uuid']);
if (isset($_POST["bresetsynchrostate"])) {
if (xmlrpc_resetSynchroState($params['target_uuid'], $params['type'])) {
new NotifyWidgetSuccess(sprintf(_T("Reset synchronisation state for %s (%s) succeed", "imaging"), $params['target_name'], $params['target_uuid']));
header("Location: " . urlStrRedirect("base/computers/imgtabs", $params));
exit;
} else {
new NotifyWidgetFailure(sprintf(_T("Failed to reset synchronise state.", "imaging")));
}
}
if ($ret['id'] == $SYNCHROSTATE_RUNNING) {
$p = new PageGenerator(sprintf(_T("%s's profile imaging", 'imaging'), $group->getName()));
$sidemenu->forceActiveItem("index");
$p->setSideMenu($sidemenu);
$p->display();
$a_href_open = "<a href=''>";
$msg = sprintf(_T("Generating boot menu... Please wait or reload the page %shere%s.<br/>", "imaging"), $a_href_open, '</a>');
$t1 = new TitleElement($msg, 3);
$t1->display();
$msg = sprintf(_T("If the processing exceeds 5 minutes, please reset the synchro state of this computer.", "imaging"));
$t2 = new TitleElement($msg, 3);
$t2->display();
$f = new ValidatingForm();
$f->add(new HiddenTpl("gid"), array("value" => $params['target_uuid'], "hide" => True));
$f->add(new HiddenTpl("groupname"), array("value" => $params['target_name'], "hide" => True));
$f->add(new HiddenTpl("type"), array("value" => $params['type'], "hide" => True));
$f->addButton("bresetsynchrostate", _T("Reset Synchro state", "imaging"));