当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPWS_Core::initCoreClass方法代码示例

本文整理汇总了PHP中PHPWS_Core::initCoreClass方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Core::initCoreClass方法的具体用法?PHP PHPWS_Core::initCoreClass怎么用?PHP PHPWS_Core::initCoreClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPWS_Core的用法示例。


在下文中一共展示了PHPWS_Core::initCoreClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
     $requestId = $context->get('requestId');
     $errorCmd = CommandFactory::getCommand('LotteryShowDenyRoommateRequest');
     $errorCmd->setRequestId($requestId);
     # Confirm the captcha
     PHPWS_Core::initCoreClass('Captcha.php');
     $captcha = Captcha::verify(TRUE);
     if ($captcha === FALSE) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'The words you entered were incorrect. Please try again.');
         $errorCmd->redirect();
     }
     # Get the roommate request
     $request = HMS_Lottery::get_lottery_roommate_invite_by_id($context->get('requestId'));
     # Make sure that the logged in user is the same as the confirming the request
     if (UserStatus::getUsername() != $request['asu_username']) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Invalid roommate request. You can not confirm that roommate request.');
         $errorCmd->redirect();
     }
     # Deny the roommate requst
     try {
         HMS_Lottery::denyRoommateRequest($requestId);
     } catch (Exception $e) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'There was an error denying the roommate request. Please contact University Housing.');
         $errorCmd->redirect();
     }
     # Log that it happened
     PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php');
     HMS_Activity_Log::log_activity(UserStatus::getUsername(), ACTIVITY_LOTTERY_ROOMMATE_DENIED, UserStatus::getUsername(), 'Captcha words: ' . $captcha);
     # Success
     NQ::simple('hms', hms\NotificationView::SUCCESS, 'The roommate request was successfully declined.');
     $successCmd = CommandFactory::getCommand('ShowStudentMenu');
     $successCmd->redirect();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:35,代码来源:LotteryDenyRoommateRequestCommand.php

示例2: __construct

 public function __construct($type = 'default')
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('faxmaster', 'Fax.php');
     $this->pager = new DBPager('faxmaster_fax', 'Fax');
     $this->pager->setModule('faxmaster');
     $this->pager->setLink('index.php?module=faxmaster');
     // Don't show hidden faxes
     $this->pager->addWhere('hidden', 0);
     // By default, sort the faxes in reverse chronological order
     $this->pager->setOrder('dateReceived', 'DESC', true);
     if ($type == 'archived') {
         $this->pager->setTemplate('archivePager.tpl');
         $this->pager->setEmptyMessage('No archived faxes found.');
         $this->pager->addRowTags('pagerRowTags', 'archived');
         $this->pager->addWhere('archived', 1);
         $this->pager->setSearch('bannerId', 'firstName', 'lastName', 'whichArchive');
     } else {
         $this->pager->setTemplate('faxPager.tpl');
         $this->pager->setEmptyMessage('No faxes found.');
         $this->pager->addRowTags('pagerRowTags');
         $this->pager->addPageTags(array('UNPRINTED_COUNT' => Fax::getUnprintedCount()));
         $this->pager->addWhere('archived', 0);
         $this->pager->setSearch('bannerId', 'firstName', 'lastName');
     }
 }
开发者ID:sinkdb,项目名称:faxserv,代码行数:26,代码来源:FaxPager.php

示例3: execute

 public function execute(CommandContext $context)
 {
     $id = $context->get('roommateId');
     if (is_null($id)) {
         throw new InvalidArgumentException('Must set roommateId');
     }
     PHPWS_Core::initModClass('hms', 'HMS_Roommate.php');
     $roommate = new HMS_Roommate($id);
     if ($roommate->id = 0) {
         throw new InvalidArgumentException('Invalid roommateId ' . $id);
     }
     $username = UserStatus::getUsername();
     if ($username != $roommate->requestor && $username != $roommate->requestee) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException("{$username} tried to break roommate pairing {$roommate->id}");
     }
     PHPWS_Core::initCoreClass('Captcha.php');
     // get other roommate
     $other = StudentFactory::getStudentByUsername($roommate->get_other_guy($username), $roommate->term);
     $form = new PHPWS_Form();
     $cmd = CommandFactory::getCommand('RoommateBreak');
     $cmd->setRoommateId($id);
     $cmd->initForm($form);
     $form->addTplTag('CAPTCHA_IMAGE', Captcha::get());
     $form->addTplTag('NAME', $other->getFullName());
     $form->addSubmit('Confirm');
     $form->addCssClass('submit', 'btn btn-danger');
     $context->setContent(PHPWS_Template::process($form->getTemplate(), 'hms', 'student/roommate_break_confirm.tpl'));
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:29,代码来源:ShowRoommateBreakCommand.php

示例4: show

 public function show()
 {
     PHPWS_Core::initCoreClass('Form.php');
     javascript('jquery');
     javascript('modules/hms/assign_student');
     $unassignCmd = CommandFactory::getCommand('UnassignStudent');
     $form = new PHPWS_Form();
     $unassignCmd->initForm($form);
     $form->addText('username');
     if (!is_null($this->student)) {
         $form->setValue('username', $this->student->getUsername());
     }
     $form->addCssClass('username', 'form-control');
     $form->setExtra('username', 'autofocus');
     // Addition of "Unassignment Type"
     $form->addDropBox('unassignment_type', array('-1' => 'Choose a reason...', UNASSIGN_ADMIN => 'Administrative', UNASSIGN_REASSIGN => 'Re-assign', UNASSIGN_CANCEL => 'Contract Cancellation', UNASSIGN_PRE_SPRING => 'Pre-spring room change', UNASSIGN_RELEASE => 'Contract Release'));
     //$form->setMatch('unassignment_type', UNASSIGN_ADMIN);
     $form->setLabel('unassignment_type', 'Unassignment Type: ');
     $form->addCssClass('unassignment_type', 'form-control');
     $form->addText('refund');
     $form->setLabel('refund', 'Refund Percentage');
     $form->setSize('refund', 4);
     $form->setMaxSize('refund', 3);
     $form->addCssClass('refund', 'form-control');
     $form->addTextarea('note');
     $form->setLabel('note', 'Note: ');
     $form->addCssClass('note', 'form-control');
     $tpl = $form->getTemplate();
     $tpl['TERM'] = Term::getPrintableSelectedTerm();
     Layout::addPageTitle("Unassign Student");
     return PHPWS_Template::process($tpl, 'hms', 'admin/unassignStudent.tpl');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:32,代码来源:UnassignStudentView.php

示例5: execute

 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'HousingApplication.php');
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'RlcMembershipFactory.php');
     PHPWS_Core::initModClass('hms', 'RlcAssignmentSelfAssignedState.php');
     $requestId = $context->get('requestId');
     $mealPlan = $context->get('mealPlan');
     $errorCmd = CommandFactory::getCommand('LotteryShowConfirmRoommateRequest');
     $errorCmd->setRequestId($requestId);
     $errorCmd->setMealPlan($mealPlan);
     // Confirm the captcha
     PHPWS_Core::initCoreClass('Captcha.php');
     $captcha = Captcha::verify(TRUE);
     if ($captcha === FALSE) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'The words you entered were incorrect. Please try again.');
         $errorCmd->redirect();
     }
     // Check for a meal plan
     if (!isset($mealPlan) || $mealPlan == '') {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Please choose a meal plan.');
         $errorCmd->redirect();
     }
     $term = PHPWS_Settings::get('hms', 'lottery_term');
     $student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);
     // Update the meal plan field on the application
     $app = HousingApplication::getApplicationByUser(UserStatus::getUsername(), $term);
     $app->setMealPlan($mealPlan);
     try {
         $app->save();
     } catch (Exception $e) {
         PHPWS_Error::log('hms', $e->getMessage());
         NQ::simple('hms', hms\NotificationView::ERROR, 'Sorry, there was an error confirming your roommate invitation. Please contact University Housing.');
         $errorCmd->redirect();
     }
     // Try to actually make the assignment
     PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
     try {
         HMS_Lottery::confirm_roommate_request(UserStatus::getUsername(), $requestId, $mealPlan);
     } catch (Exception $e) {
         PHPWS_Error::log('hms', $e->getMessage());
         NQ::simple('hms', hms\NotificationView::ERROR, 'Sorry, there was an error confirming your roommate invitation. Please contact University Housing.');
         $errorCmd->redirect();
     }
     # Log the fact that the roommate was accepted and successfully assigned
     HMS_Activity_Log::log_activity(UserStatus::getUsername(), ACTIVITY_LOTTERY_CONFIRMED_ROOMMATE, UserStatus::getUsername(), "Captcha: \"{$captcha}\"");
     // Check for an RLC membership and update status if necessary
     // If this student was an RLC self-select, update the RLC memberhsip state
     $rlcAssignment = RlcMembershipFactory::getMembership($student, $term);
     if ($rlcAssignment != null && $rlcAssignment->getStateName() == 'selfselect-invite') {
         $rlcAssignment->changeState(new RlcAssignmentSelfAssignedState($rlcAssignment));
     }
     $invite = HMS_Lottery::get_lottery_roommate_invite_by_id($requestId);
     $successCmd = CommandFactory::getCommand('LotteryShowConfirmedRoommateThanks');
     $successCmd->setRequestId($requestId);
     $successCmd->redirect();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:57,代码来源:LotteryConfirmRoommateRequestCommand.php

示例6: show

 public function show()
 {
     $f = $this->feature;
     $reg = $f->getRegistration();
     PHPWS_Core::initCoreClass('Form.php');
     $form = new PHPWS_Form($reg->getName());
     $cmd = CommandFactory::getCommand('SaveApplicationFeature');
     if ($f->getId() < 1) {
         $cmd->setName($reg->getName());
         $cmd->setTerm($f->getTerm());
     } else {
         $cmd->setFeatureId($f->getId());
     }
     $cmd->initForm($form);
     // TODO: Command Business
     $form->addCheck('enabled');
     if ($f->isEnabled()) {
         $form->setMatch('enabled', true);
     }
     $form->setLabel('enabled', $reg->getDescription());
     if ($reg->requiresStartDate()) {
         $form->addText('start_date');
         $form->setExtra('start_date', 'class="datepicker"');
         if (!is_null($f->getStartDate())) {
             $form->setValue('start_date', strftime('%m/%d/%Y', $f->getStartDate()));
         }
         $form->setLabel('start_date', dgettext('hms', 'Start Date:'));
         $form->addCssClass('start_date', 'form-control');
         $form->addCssClass('start_date', 'datepicker');
     }
     if ($reg->requiresEditDate()) {
         $form->addText('edit_date');
         if (!is_null($f->getEditDate())) {
             $form->setValue('edit_date', strftime('%m/%d/%Y', $f->getEditDate()));
         }
         $form->setLabel('edit_date', dgettext('hms', 'Edit Date:'));
         $form->addCssClass('edit_date', 'form-control');
         $form->addCssClass('edit_date', 'datepicker');
     }
     if ($reg->requiresEndDate()) {
         $form->addText('end_date');
         if (!is_null($f->getEndDate())) {
             $form->setValue('end_date', strftime('%m/%d/%Y', $f->getEndDate()));
         }
         $form->setLabel('end_date', dgettext('hms', 'End Date:'));
         $form->addCssClass('end_date', 'form-control');
         $form->addCssClass('end_date', 'datepicker');
     }
     $form->addSubmit('Save');
     $form->addReset('Undo');
     javascript('datepicker');
     $vars = array('FORM_SELECT' => '.app-feature-setting form', 'ENABLE_SELECT' => 'input[name="enabled"]', 'HIDDEN_SELECT' => '.app-feature-setting-hidable', 'SUBMIT_SELECT' => '.app-feature-setting-submit');
     javascript('modules/hms/ajaxForm', $vars);
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'hms', 'admin/ApplicationFeatureSettingsView.tpl');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:56,代码来源:ApplicationFeatureSettingsView.php

示例7: show

 public function show()
 {
     PHPWS_Core::initCoreClass('Form.php');
     $form = new PHPWS_Form();
     $submitCmd = CommandFactory::getCommand('EmergencyContactFormSubmit');
     $submitCmd->setTerm($this->term);
     $submitCmd->initForm($form);
     $tpl = array();
     /****************
      * Display Info *
      ****************/
     $tpl['TERM'] = Term::toString($this->term);
     $tpl['STUDENT_NAME'] = $this->student->getFullName();
     /*********************
      * Emergency Contact *
      *********************/
     $form->addText('emergency_contact_name');
     $form->addCssClass('emergency_contact_name', 'form-control');
     $form->addText('emergency_contact_relationship');
     $form->addCssClass('emergency_contact_relationship', 'form-control');
     $form->addText('emergency_contact_phone');
     $form->addCssClass('emergency_contact_phone', 'form-control');
     $form->addText('emergency_contact_email');
     $form->addCssClass('emergency_contact_email', 'form-control');
     $form->addTextArea('emergency_medical_condition');
     $form->addCssClass('emergency_medical_condition', 'form-control');
     if (!is_null($this->application)) {
         $form->setValue('emergency_contact_name', $this->application->getEmergencyContactName());
         $form->setValue('emergency_contact_relationship', $this->application->getEmergencyContactRelationship());
         $form->setValue('emergency_contact_phone', $this->application->getEmergencyContactPhone());
         $form->setValue('emergency_contact_email', $this->application->getEmergencyContactEmail());
         $form->setValue('emergency_medical_condition', $this->application->getEmergencyMedicalCondition());
     }
     /******************
      * Missing Person *
      ******************/
     $form->addText('missing_person_name');
     $form->addCssClass('missing_person_name', 'form-control');
     $form->addText('missing_person_relationship');
     $form->addCssClass('missing_person_relationship', 'form-control');
     $form->addText('missing_person_phone');
     $form->addCssClass('missing_person_phone', 'form-control');
     $form->addText('missing_person_email');
     $form->addCssClass('missing_person_email', 'form-control');
     if (!is_null($this->application)) {
         $form->setValue('missing_person_name', $this->application->getMissingPersonName());
         $form->setValue('missing_person_relationship', $this->application->getMissingPersonRelationship());
         $form->setValue('missing_person_phone', $this->application->getMissingPersonPhone());
         $form->setValue('missing_person_email', $this->application->getMissingPersonEmail());
     }
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     Layout::addPageTitle("Emergency Contact Form");
     return PHPWS_Template::process($tpl, 'hms', 'student/emergency_contact_form.tpl');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:55,代码来源:EmergencyContactFormView.php

示例8: shortcuts

 public static function shortcuts()
 {
     if (!Current_User::allow('access')) {
         Current_User::disallow();
         return;
     }
     $modal = new Modal('access-shortcut', null, dgettext('access', 'Shortcuts'));
     $modal->sizeSmall();
     $button = '<button class="btn btn-success" id="save-shortcut">Save</button>';
     $modal->addButton($button);
     \Layout::add((string) $modal);
     javascript('jquery');
     \Layout::includeJavascript('mod/access/javascript/access.min.js');
     PHPWS_Core::initModClass('access', 'Shortcut.php');
     PHPWS_Core::initCoreClass('DBPager.php');
     $pager = new DBPager('access_shortcuts', 'Access_Shortcut');
     $pager->setModule('access');
     $pager->setTemplate('forms/shortcut_list.tpl');
     $pager->setLink('index.php?module=access&amp;tab=shortcuts');
     $pager->addToggle('class="bgcolor1"');
     $pager->setSearch('keyword');
     $form = new PHPWS_Form('shortcut_list');
     $form->addHidden('module', 'access');
     $form->addHidden('command', 'post_shortcut_list');
     $options['none'] = '';
     if (Current_User::allow('access', 'admin_options')) {
         $options['active'] = dgettext('access', 'Activate');
         $options['deactive'] = dgettext('access', 'Deactivate');
     }
     $options['delete'] = dgettext('access', 'Delete');
     $form->addSelect('list_action', $options);
     $page_tags = $form->getTemplate();
     $page_tags['MENU_FIX'] = PHPWS_Text::secureLink(dgettext('access', 'Update menu links'), 'access', array('command' => 'menu_fix'));
     $page_tags['PAGE_FIX'] = PHPWS_Text::secureLink(dgettext('access', 'Shortcut all pages'), 'access', array('command' => 'page_fix'));
     if (PHPWS_Settings::get('access', 'forward_ids')) {
         $page_tags['PAGE_FORWARDING'] = PHPWS_Text::secureLink(dgettext('access', 'Turn OFF autoforwarding of Pagesmith id pages'), 'access', array('command' => 'autoforward_off'));
     } else {
         $page_tags['PAGE_FORWARDING'] = PHPWS_Text::secureLink(dgettext('access', 'Turn ON autoforwarding of Pagesmith id pages'), 'access', array('command' => 'autoforward_on'));
     }
     $page_tags['MENU_WARNING'] = dgettext('menu', 'This change is irreversable. Please backup menu_links prior to running it.');
     $page_tags['URL_LABEL'] = dgettext('access', 'Url');
     $page_tags['ACTIVE_LABEL'] = dgettext('access', 'Active?');
     $page_tags['ACTION_LABEL'] = dgettext('access', 'Action');
     $page_tags['CHECK_ALL_SHORTCUTS'] = javascript('check_all', array('checkbox_name' => 'shortcut[]'));
     $js_vars['value'] = dgettext('access', 'Go');
     $js_vars['select_id'] = $form->getId('list_action');
     $js_vars['action_match'] = 'delete';
     $js_vars['message'] = dgettext('access', 'Are you sure you want to delete the checked shortcuts?');
     $page_tags['SUBMIT'] = javascript('select_confirm', $js_vars);
     $pager->addPageTags($page_tags);
     $pager->addRowTags('rowTags');
     $content = $pager->get();
     return $content;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:54,代码来源:Forms.php

示例9: doPager

 public static function doPager()
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('intern', 'Major.php');
     $pager = new DBPager('intern_major', 'Major');
     $pager->db->addOrder('name asc');
     $pager->setModule('intern');
     $pager->setTemplate('major_pager.tpl');
     $pager->setEmptyMessage('No Majors Found.');
     $pager->addRowTags('getRowTags');
     return $pager->get();
 }
开发者ID:jeffrafter,项目名称:InternshipInventory,代码行数:12,代码来源:MajorUI.php

示例10: show

 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
     PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     # Get the roommate request record from the database
     $bed = new HMS_Bed($this->request['bed_id']);
     $room = $bed->get_parent();
     $tpl = array();
     $requestor = StudentFactory::getStudentByUsername($this->request['requestor'], $this->term);
     $tpl['REQUESTOR'] = $requestor->getName();
     $tpl['HALL_ROOM'] = $bed->where_am_i();
     # List all the students which will be assigned and their beds
     $beds = $room->get_beds();
     foreach ($beds as $bed) {
         $bed_row = array();
         # Check for an assignment
         $bed->loadAssignment();
         # Check for a reservation
         $reservation = $bed->get_lottery_reservation_info();
         $bed_row['BEDROOM_LETTER'] = $bed->bedroom_label;
         if ($bed->_curr_assignment != NULL) {
             # Bed is assigned
             $roommate = StudentFactory::getStudentByUsername($bed->_curr_assignment->asu_username, $this->term);
             $bed_row['TEXT'] = $roommate->getName();
         } else {
             if ($reservation != NULL) {
                 # Bed is reserved
                 $roommate = StudentFactory::getStudentByUsername($reservation['asu_username'], $this->term);
                 $bed_row['TEXT'] = $roommate->getName() . ' (reserved)';
             } else {
                 $bed_row['TEXT'] = 'Empty';
             }
         }
         $tpl['beds'][] = $bed_row;
     }
     $tpl['MEAL_PLAN'] = HMS_Util::formatMealOption($this->mealPlan);
     PHPWS_Core::initCoreClass('Captcha.php');
     $tpl['CAPTCHA'] = Captcha::get();
     $submitCmd = CommandFactory::getCommand('LotteryConfirmRoommateRequest');
     $submitCmd->setRequestId($this->request['id']);
     $submitCmd->setMealPlan($this->mealPlan);
     $form = new PHPWS_Form();
     $submitCmd->initForm($form);
     $form->addSubmit('confirm', 'Confirm Roommate');
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     Layout::addPageTitle("Lottery Confirm Roommate");
     return PHPWS_Template::process($tpl, 'hms', 'student/lottery_confirm_roommate_request.tpl');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:51,代码来源:LotteryConfirmRoommateRequestView.php

示例11: show_username_change

 public function show_username_change()
 {
     if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'username_change')) {
         $tpl = array();
         return PHPWS_Template::process($tpl, 'hms', 'admin/permission_denied.tpl');
     }
     PHPWS_Core::initCoreClass('Form.php');
     $form =& new PHPWS_Form();
     $form->addTextarea('usernames');
     $form->addSubmit('submit', 'Submit');
     $form->addHidden('module', 'hms');
     $form->addHidden('type', 'admin');
     $form->addHidden('op', 'process_username_change');
     return PHPWS_Template::process($form->getTemplate(), 'hms', 'admin/username_change.tpl');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:15,代码来源:HMS_Admin.php

示例12: show

 public function show()
 {
     PHPWS_Core::initCoreClass('Form.php');
     $form = new PHPWS_Form();
     $form->addDropBox('rlc', HMS_Learning_Community::getRlcList());
     $form->setClass('rlc', 'form-control');
     $form->addHidden('module', 'hms');
     $form->addHidden('action', 'ShowSearchByRlc');
     $form->addSubmit('submit', _('Search'));
     $form->setClass('submit', 'btn btn-primary pull-right');
     $tags = $form->getTemplate();
     $tags['TITLE'] = "RLC Search";
     Layout::addPageTitle("RLC Search");
     $final = PHPWS_Template::processTemplate($tags, 'hms', 'admin/search_by_rlc.tpl');
     return $final;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:16,代码来源:SearchByRlcView.php

示例13: execute

 public function execute(CommandContext $context)
 {
     $id = $context->get('roommateId');
     if (is_null($id)) {
         throw new InvalidArgumentException('Must set roommateId');
     }
     PHPWS_Core::initModClass('hms', 'HMS_Roommate.php');
     $roommate = new HMS_Roommate($id);
     if ($roommate->id == 0) {
         throw new InvalidArgumentException('Invalid roommateId ' . $id);
     }
     $username = UserStatus::getUsername();
     if ($username != $roommate->requestee) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException("{$username} tried to confirm roommate pairing {$roommate->id}");
     }
     $err = CommandFactory::getCommand('ShowRoommateConfirmAccept');
     $err->setRoommateId($id);
     PHPWS_Core::initCoreClass('Captcha.php');
     $verified = Captcha::verify(TRUE);
     if ($verified === FALSE || is_null($verified)) {
         NQ::Simple('hms', hms\NotificationView::ERROR, 'Sorry, please try again.');
         $err->redirect();
     }
     try {
         $roommate->confirm();
     } catch (RoommateCompatibilityException $rce) {
         NQ::simple('hms', hms\NotificationView::WARNING, $rce->getMessage());
         $err->redirect();
     }
     $roommate->save();
     HMS_Activity_Log::log_activity($roommate->requestor, ACTIVITY_ACCEPTED_AS_ROOMMATE, $roommate->requestee, "{$roommate->requestee} accepted request, CAPTCHA: {$verified}");
     HMS_Activity_Log::log_activity($roommate->requestee, ACTIVITY_ACCEPTED_AS_ROOMMATE, $roommate->requestor, "{$roommate->requestee} accepted request, CAPTCHA: {$verified}");
     // Email both parties
     PHPWS_Core::initModClass('hms', 'HMS_Email.php');
     HMS_Email::send_confirm_emails($roommate);
     // Remove any other requests for the requestor
     HMS_Roommate::removeOutstandingRequests($roommate->requestor, $roommate->term);
     // Remove any other requests for the requestee
     HMS_Roommate::removeOutstandingRequests($roommate->requestee, $roommate->term);
     $requestor = StudentFactory::getStudentByUsername($roommate->requestor, $roommate->term);
     $name = $requestor->getFullName();
     NQ::Simple('hms', hms\NotificationView::SUCCESS, "You and {$name} are confirmed as roommates.");
     $cmd = CommandFactory::getCommand('ShowStudentMenu');
     $cmd->redirect();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:46,代码来源:RoommateAcceptCommand.php

示例14: __construct

 public function __construct($type = 'default')
 {
     PHPWS_Core::initCoreClass('DBPager.php');
     PHPWS_Core::initModClass('faxmaster', 'ActionLog.php');
     $this->pager = new DBPager('faxmaster_action_log', 'RestoredActionLog');
     $this->pager->setModule('faxmaster');
     $this->pager->setLink('index.php?module=faxmaster');
     // Zebra stripe the fax list
     $this->pager->addToggle('class="bgcolor1"');
     $this->pager->addToggle('class="bgcolor2"');
     // By default, sort the faxes in reverse chronological order
     $this->pager->setOrder('timePerformed', 'DESC', true);
     $this->pager->setTemplate('actionLogList.tpl');
     $this->pager->setEmptyMessage('No actions found.');
     $this->pager->addRowTags('rowTags');
     $this->pager->setSearch('username');
 }
开发者ID:sinkdb,项目名称:faxserv,代码行数:17,代码来源:ActionLogPager.php

示例15: showFilters

 /**
  * Shows filtering options for the log view.  The first argument is usually
  * $_SESSION. The second argument is laid out in the same way, and
  * specifies default values.  If a default value is specified in the second
  * argument, that option will not appear in the filter; this way, if you're
  * in the Student Info thing, you can show the activity log for only that
  * user.
  */
 public static function showFilters($selection = NULL)
 {
     PHPWS_Core::initCoreClass('Form.php');
     $submitCmd = CommandFactory::getCommand('ShowActivityLog');
     $form = new PHPWS_Form();
     $submitCmd->initForm($form);
     $form->setMethod('get');
     $form->addText('actor');
     $form->setLabel('actor', 'Action Performed By:');
     if (isset($selection['actor'])) {
         $form->setValue('actor', $selection['actor']);
     }
     $form->addText('actee');
     $form->setLabel('actee', 'Action Affected:');
     if (isset($selection['actee'])) {
         $form->setValue('actee', $selection['actee']);
     }
     // "exact" flag
     $form->addCheck('exact', 'yes');
     $form->setMatch('exact', 'yes');
     $form->setLabel('exact', 'Exact? ');
     $form->addText('begin', isset($selection['begin']) ? $selection['begin'] : '');
     $form->setClass('begin', 'datepicker');
     $form->addText('end', isset($selection['end']) ? $selection['end'] : '');
     $form->setClass('end', 'datepicker');
     $form->addText('notes');
     $form->setLabel('notes', 'Note:');
     if (isset($selection['notes'])) {
         $form->setValue('notes', $selection['notes']);
     }
     $activities = HMS_Activity_Log::getActivityMapping();
     foreach ($activities as $id => $text) {
         $name = "a{$id}";
         $form->addCheckbox($name);
         $form->setLabel($name, $text);
         $form->setMatch($name, isset($selection[$name]));
     }
     $form->addSubmit('Refresh');
     $tpl = $form->getTemplate();
     $tpl['BEGIN_LABEL'] = 'After:';
     $tpl['END_LABEL'] = 'Before:';
     javascript('jquery');
     javascript('modules/hms/activity_log');
     return PHPWS_Template::process($tpl, 'hms', 'admin/activity_log_filters.tpl');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:53,代码来源:ActivityLogView.php


注:本文中的PHPWS_Core::initCoreClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。