本文整理汇总了PHP中Symfony\Component\HttpFoundation\Session\SessionInterface::get方法的典型用法代码示例。如果您正苦于以下问题:PHP SessionInterface::get方法的具体用法?PHP SessionInterface::get怎么用?PHP SessionInterface::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpFoundation\Session\SessionInterface
的用法示例。
在下文中一共展示了SessionInterface::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
$clientId = $session->get('client/id');
$helpdeskFlag = 0;
$loggedInUser = Util::checkUserIsLoggedIn();
if ($loggedInUser) {
if ($session->get('selected_product_id') == SystemProduct::SYS_PRODUCT_HELP_DESK) {
$helpdeskFlag = 1;
}
}
$projectId = $request->request->get('id');
$date = date("Y-m-d", strtotime("-1 month"));
$date = date('Y-m-d', strtotime("+1 day", strtotime($date)));
$dateWithoutYear = date("d M", strtotime("-1 month"));
$currentDate = date("Y-m-d");
$result = array();
while (strtotime($date) <= strtotime($currentDate)) {
$countAllIssues = $this->getRepository(YongoProject::class)->getTotalIssuesPreviousDate($clientId, $projectId, $date, $helpdeskFlag);
$resolvedCount = $this->getRepository(YongoProject::class)->getTotalIssuesResolvedOnDate($clientId, $projectId, $date, $helpdeskFlag);
$result[] = array($dateWithoutYear, $countAllIssues, $resolvedCount);
$dateWithoutYear = date('d M', strtotime("+1 day", strtotime($date)));
$date = date('Y-m-d', strtotime("+1 day", strtotime($date)));
}
return new JsonResponse($result);
}
示例2: buildView
/**
* @param \Symfony\Component\Form\FormView $view
* @param \Symfony\Component\Form\FormInterface $form
* @param array $options
*/
public function buildView(FormView $view, FormInterface $form, array $options)
{
if ($options['reload'] && !$options['as_url']) {
throw new \InvalidArgumentException('GregwarCaptcha: The reload option cannot be set without as_url, see the README for more information');
}
$sessionKey = sprintf('gcb_%s', $form->getName());
$isHuman = false;
if ($options['humanity'] > 0) {
$humanityKey = sprintf('%s_humanity', $sessionKey);
if ($this->session->get($humanityKey, 0) > 0) {
$isHuman = true;
}
}
if ($options['as_url']) {
$keys = $this->session->get($options['whitelist_key'], array());
if (!in_array($sessionKey, $keys)) {
$keys[] = $sessionKey;
}
$this->session->set($options['whitelist_key'], $keys);
$options['session_key'] = $sessionKey;
}
$view->vars = array_merge($view->vars, array('captcha_width' => $options['width'], 'captcha_height' => $options['height'], 'reload' => $options['reload'], 'image_id' => uniqid('captcha_'), 'captcha_code' => $this->generator->getCaptchaCode($options), 'value' => '', 'is_human' => $isHuman));
$persistOptions = array();
foreach (array('phrase', 'width', 'height', 'distortion', 'length', 'quality', 'background_color', 'text_color') as $key) {
$persistOptions[$key] = $options[$key];
}
$this->session->set($sessionKey, $persistOptions);
}
示例3: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$emptyName = false;
$alreadyExists = false;
if ($request->request->has('new_role')) {
$name = Util::cleanRegularInputField($request->request->get('name'));
$description = Util::cleanRegularInputField($request->request->get('description'));
if (empty($name)) {
$emptyName = true;
}
$role = $this->getRepository(Role::class)->getByName($session->get('client/id'), $name);
if ($role) {
$alreadyExists = true;
}
if (!$emptyName && !$alreadyExists) {
$date = Util::getServerCurrentDateTime();
$this->getRepository(Role::class)->add($session->get('client/id'), $name, $description, $date);
$this->getLogger()->addInfo('ADD Yongo Project Role ' . $name, $this->getLoggerContext());
return new RedirectResponse('/yongo/administration/roles');
}
}
$menuSelectedCategory = 'user';
$sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Create Role';
return $this->render(__DIR__ . '/../../../Resources/views/administration/role/Add.php', get_defined_vars());
}
示例4: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$menuSelectedCategory = 'system';
$emptyName = false;
$eventId = $request->get('id');
$event = $this->getRepository(IssueEvent::class)->getById($eventId);
if ($event['client_id'] != $session->get('client/id')) {
return new RedirectResponse('/general-settings/bad-link-access-denied');
}
if ($request->request->has('edit_event')) {
$name = Util::cleanRegularInputField($request->request->get('name'));
$description = Util::cleanRegularInputField($request->request->get('description'));
if (empty($name)) {
$emptyName = true;
}
if (!$emptyName) {
$currentDate = Util::getServerCurrentDateTime();
$this->getRepository(IssueEvent::class)->updateById($eventId, $name, $description, $currentDate);
$this->getLogger()->addInfo('UPDATE Yongo Event ' . $name, $this->getLoggerContext());
return new RedirectResponse('/yongo/administration/events');
}
}
$sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Update Event';
return $this->render(__DIR__ . '/../../../Resources/views/administration/event/edit.php', get_defined_vars());
}
示例5: getLoggedUser
/**
* @return \PHPSC\Conference\Domain\Entity\User
*/
public function getLoggedUser()
{
if (!$this->isLogged() && $this->session->has('loggedUser')) {
$this->loggedUser = $this->userManager->getById($this->session->get('loggedUser'));
}
return $this->loggedUser;
}
示例6: retrieve
public function retrieve($id)
{
if (!is_string($id)) {
throw InvalidArgumentException::invalidType('string', 'uuid', $id);
}
return $this->session->get(sprintf('%s:%s', $this->namespace, $id));
}
示例7: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$emptyPriorityName = false;
$priorityExists = false;
if ($request->request->has('new_priority')) {
$name = Util::cleanRegularInputField($request->request->get('name'));
$description = Util::cleanRegularInputField($request->request->get('description'));
$color = Util::cleanRegularInputField($request->request->get('color'));
if (empty($name)) {
$emptyPriorityName = true;
}
// check for duplication
$priority = $this->getRepository(IssueSettings::class)->getByName($session->get('client/id'), 'priority', mb_strtolower($name));
if ($priority) {
$priorityExists = true;
}
if (!$priorityExists && !$emptyPriorityName) {
$iconName = 'generic.png';
$currentDate = Util::getServerCurrentDateTime();
$this->getRepository(IssueSettings::class)->create('issue_priority', $session->get('client/id'), $name, $description, $iconName, $color, $currentDate);
$this->getLogger()->addInfo('ADD Yongo Issue Priority ' . $name, $this->getLoggerContext());
return new RedirectResponse('/yongo/administration/issue/priorities');
}
}
$menuSelectedCategory = 'issue';
$sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Create Issue Priority';
return $this->render(__DIR__ . '/../../../../Resources/views/administration/issue/priority/Add.php', get_defined_vars());
}
示例8: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$emptyName = false;
$duplicateName = false;
if ($request->request->has('add_project_category')) {
$name = Util::cleanRegularInputField($request->request->get('name'));
$description = Util::cleanRegularInputField($request->request->get('description'));
if (empty($name)) {
$emptyName = true;
} else {
$data = $this->getRepository(ProjectCategory::class)->getByName($name, null, $session->get('client/id'));
if ($data) {
$duplicateName = true;
}
}
if (!$emptyName && !$duplicateName) {
$projectCategory = new ProjectCategory($session->get('client/id'), $name, $description);
$currentDate = Util::getServerCurrentDateTime();
$projectCategory->save($currentDate);
$this->getLogger()->addInfo('ADD Yongo Project Category ' . $name, $this->getLoggerContext());
return new RedirectResponse('/yongo/administration/project/categories');
}
}
$menuSelectedCategory = 'project';
$sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Create Project Category';
return $this->render(__DIR__ . '/../../../../Resources/views/administration/project/category/Add.php', get_defined_vars());
}
示例9: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$clientId = $session->get('client/id');
$loggedInUserId = $session->get('user/id');
$stepPropertyId = $request->get('id');
$stepProperty = $this->getRepository(Workflow::class)->getStepPropertyById($stepPropertyId);
$step = $this->getRepository(Workflow::class)->getStepById($stepProperty['workflow_step_id']);
$stepId = $step['id'];
$workflowId = $step['workflow_id'];
$workflowMetadata = $this->getRepository(Workflow::class)->getMetaDataById($workflowId);
$allProperties = $this->getRepository(Workflow::class)->getSystemWorkflowProperties();
$emptyValue = false;
$duplicateKey = false;
$value = $stepProperty['value'];
if ($request->request->has('edit_property')) {
$keyId = Util::cleanRegularInputField($request->request->get('key'));
$value = Util::cleanRegularInputField($request->request->get('value'));
if (empty($value)) {
$emptyValue = true;
}
if (!$emptyValue) {
$duplicateKey = $this->getRepository(Workflow::class)->getStepKeyByStepIdAndKeyId($stepId, $keyId, $stepProperty['id']);
if (!$duplicateKey) {
$currentDate = Util::getServerCurrentDateTime();
$this->getRepository(Workflow::class)->updateStepPropertyById($stepPropertyId, $keyId, $value, $currentDate);
$this->getLogger()->addInfo('UPDATE Yongo Workflow Step Property', $this->getLoggerContext());
return new RedirectResponse('/yongo/administration/workflow/view-step-properties/' . $stepId);
}
}
}
$menuSelectedCategory = 'issue';
$sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Update Workflow Step Property';
return $this->render(__DIR__ . '/../../../../../Resources/views/administration/workflow/step/property/Edit.php', get_defined_vars());
}
示例10: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$loggedInUserId = $session->get('user/id');
$issueId = $request->request->get('issue_id');
$attachIdsToBeKept = $request->request->get('attach_ids');
$comment = Util::cleanRegularInputField($request->request->get('comment'));
if (!is_array($attachIdsToBeKept)) {
$attachIdsToBeKept = array();
}
Util::manageModalAttachments($issueId, $session->get('user/id'), $attachIdsToBeKept);
if (!empty($comment)) {
$currentDate = Util::getServerCurrentDateTime();
$this->getRepository(IssueComment::class)->add($issueId, $session->get('user/id'), $comment, $currentDate);
}
// send email notification
$issueQueryParameters = array('issue_id' => $issueId);
$issue = $this->getRepository(Issue::class)->getByParameters($issueQueryParameters, $loggedInUserId);
$project = $this->getRepository(YongoProject::class)->getById($issue['issue_project_id']);
$issueEventData = array('user_id' => $loggedInUserId, 'attachmentIds' => UbirimiContainer::get()['session']->get('added_attachments_in_screen'), 'comment' => $comment);
$issueEvent = new IssueEvent($issue, $project, IssueEvent::STATUS_UPDATE, $issueEventData);
UbirimiContainer::get()['dispatcher']->dispatch(YongoEvents::YONGO_ISSUE_ADD_ATTACHMENT, $issueEvent);
UbirimiContainer::get()['session']->remove('added_attachments_in_screen');
return new Response('');
}
示例11: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
$loggedInUserId = null;
if (Util::checkUserIsLoggedIn()) {
$loggedInUserId = $session->get('user/id');
$session->set('selected_product_id', SystemProduct::SYS_PRODUCT_DOCUMENTADOR);
$sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_DOCUMENTADOR_NAME . ' / Dashboard';
} else {
$httpHOST = Util::getHttpHost();
$clientId = $this->getRepository(UbirimiClient::class)->getByBaseURL($httpHOST, 'array', 'id');
$sectionPageTitle = SystemProduct::SYS_PRODUCT_DOCUMENTADOR_NAME . ' / Dashboard';
}
$type = $request->get('type');
$menuSelectedCategory = 'documentator';
if ($type == 'spaces') {
if (Util::checkUserIsLoggedIn()) {
$spaces = $this->getRepository(Space::class)->getByClientId($session->get('client/id'), 1);
} else {
$spaces = $this->getRepository(Space::class)->getByClientIdAndAnonymous($session->get('client/id'));
}
} else {
if ($type == 'pages') {
$pages = $this->getRepository(Entity::class)->getFavouritePagesByClientIdAndUserId($session->get('client/id'), $loggedInUserId);
}
}
return $this->render(__DIR__ . '/../Resources/views/Dashboard.php', get_defined_vars());
}
示例12: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
if (Util::checkUserIsLoggedIn()) {
$clientId = $session->get('client/id');
$loggedInUserId = $session->get('user/id');
} else {
$clientId = $this->getRepository(UbirimiClient::class)->getClientIdAnonymous();
$loggedInUserId = null;
}
$projectId = $request->request->get('id');
$selectedProjectId = $projectId;
if ($projectId == -1) {
$projects = array();
$projectsForBrowsing = $this->getRepository(UbirimiClient::class)->getProjectsByPermission($clientId, $loggedInUserId, Permission::PERM_BROWSE_PROJECTS, 'array');
for ($i = 0; $i < count($projectsForBrowsing); $i++) {
$projects[] = $projectsForBrowsing[$i]['id'];
}
} else {
$projects = array((int) $projectId);
}
$issueQueryParameters = array('issues_per_page' => 20, 'resolution' => array(-2), 'sort' => 'code', 'sort_order' => 'desc', 'project' => $projects);
if ($loggedInUserId) {
$issueQueryParameters['not_assignee'] = $loggedInUserId;
}
$issuesUnresolvedOthers = $this->getRepository(Issue::class)->getByParameters($issueQueryParameters, $loggedInUserId, null, $loggedInUserId);
$renderParameters = array('issues' => $issuesUnresolvedOthers, 'render_checkbox' => false, 'show_header' => true);
$renderColumns = array('code', 'summary', 'priority', 'assignee');
$projects = $this->getRepository(UbirimiClient::class)->getProjectsByPermission($clientId, $loggedInUserId, Permission::PERM_BROWSE_PROJECTS, 'array');
$projectIdsNames = array();
for ($i = 0; $i < count($projects); $i++) {
$projectIdsNames[] = array($projects[$i]['id'], $projects[$i]['name']);
}
$clientSettings = $session->get('client/settings');
return $this->render(__DIR__ . '/../../Resources/views/charts/ViewUnresolvedOthers.php', get_defined_vars());
}
示例13: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$loggedInUserId = $session->get('user/id');
$menuSelectedCategory = 'issue';
$clientSettings = $session->get('client/settings');
$issues = $this->getRepository(Issue::class)->getByParameters(array('issue_id' => UbirimiContainer::get()['session']->get('bulk_change_issue_ids'), $loggedInUserId));
if ($request->request->has('confirm')) {
if (UbirimiContainer::get()['session']->get('bulk_change_operation_type') == 'delete') {
$issueIds = UbirimiContainer::get()['session']->get('bulk_change_issue_ids');
for ($i = 0; $i < count($issueIds); $i++) {
if (UbirimiContainer::get()['session']->get('bulk_change_send_operation_email')) {
$issue = $this->getRepository(Issue::class)->getByParameters(array('issue_id' => $issueIds[$i]), $loggedInUserId);
$issueEvent = new IssueEvent($issue, null, IssueEvent::STATUS_DELETE);
$this->getLogger()->addInfo('DELETE Yongo issue ' . $issue['project_code'] . '-' . $issue['nr'], $this->getLoggerContext());
UbirimiContainer::get()['dispatcher']->dispatch(YongoEvents::YONGO_ISSUE_EMAIL, $issueEvent);
}
$this->getRepository(Issue::class)->deleteById($issueIds[$i]);
$this->getRepository(IssueAttachment::class)->deleteByIssueId($issueIds[$i]);
// also delete the substaks
$childrenIssues = $this->getRepository(Issue::class)->getByParameters(array('parent_id' => $issueIds[$i]), $loggedInUserId);
while ($childrenIssues && ($childIssue = $childrenIssues->fetch_array(MYSQLI_ASSOC))) {
$this->getRepository(Issue::class)->deleteById($childIssue['id']);
$this->getRepository(IssueAttachment::class)->deleteByIssueId($childIssue['id']);
}
}
}
return new RedirectResponse('/yongo/issue/search?' . UbirimiContainer::get()['session']->get('bulk_change_choose_issue_query_url'));
}
$sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_YONGO_NAME . ' / Bulk: Operation Confirmation';
return $this->render(__DIR__ . '/../../../Resources/views/issue/bulk/OperationConfirmation.php', get_defined_vars());
}
示例14: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$calendarId = $request->get('id');
$calendar = $this->getRepository(UbirimiCalendar::class)->getById($calendarId);
$defaultReminders = $this->getRepository(UbirimiCalendar::class)->getReminders($calendarId);
if ($calendar['client_id'] != $session->get('client/id')) {
return new RedirectResponse('/general-settings/bad-link-access-denied');
}
if ($request->request->has('edit_calendar_settings')) {
$date = Util::getServerCurrentDateTime();
$this->getRepository(UbirimiCalendar::class)->deleteReminders($calendarId);
$this->getRepository(UbirimiCalendar::class)->deleteSharesByCalendarId($calendarId);
// reminder information
foreach ($request->request as $key => $value) {
if (strpos($key, 'reminder_type_') !== false) {
$indexReminder = str_replace('reminder_type_', '', $key);
$reminderType = Util::cleanRegularInputField($request->request->get($key));
$reminderValue = $request->request->get('value_reminder_' . $indexReminder);
$reminderPeriod = $request->request->get('reminder_period_' . $indexReminder);
// add the reminder
if (is_numeric($reminderValue)) {
$this->getRepository(UbirimiCalendar::class)->addReminder($calendarId, $reminderType, $reminderPeriod, $reminderValue);
}
}
}
$this->getLogger()->addInfo('UPDATE Calendar Default Reminders ' . $calendar['name'], $this->getLoggerContext());
return new RedirectResponse('/calendar/calendars');
}
$menuSelectedCategory = 'calendar';
$sectionPageTitle = $session->get('client/settings/title_name') . ' / ' . SystemProduct::SYS_PRODUCT_CALENDAR_NAME . ' / Calendar: ' . $calendar['name'] . ' / Settings';
return $this->render(__DIR__ . '/../Resources/views/Settings.php', get_defined_vars());
}
示例15: indexAction
public function indexAction(Request $request, SessionInterface $session)
{
Util::checkUserIsLoggedInAndRedirect();
$emptyName = false;
$duplicateName = false;
$name = Util::cleanRegularInputField($request->request->get('name'));
$description = Util::cleanRegularInputField($request->request->get('description'));
if (empty($name)) {
$emptyName = true;
}
$notebookSameName = $this->getRepository(Notebook::class)->getByName($session->get('user/id'), $name);
if ($notebookSameName) {
$duplicateName = true;
}
if (!$emptyName && !$duplicateName) {
$currentDate = Util::getServerCurrentDateTime();
$defaultFlag = 0;
// get the default notebook
$defaultNotebook = $this->getRepository(Notebook::class)->getDefaultByUserId($session->get('user/id'));
if (!$defaultNotebook) {
$defaultFlag = 1;
}
$notebookId = $this->getRepository(Notebook::class)->save($session->get('user/id'), $name, $description, $defaultFlag, $currentDate);
$this->getLogger()->addInfo('ADD QUICK NOTES notebook ' . $name, $this->getLoggerContext());
}
return new Response('');
}