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


PHP PHPWS_Core::initModClass方法代码示例

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


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

示例1: execute

 public function execute(CommandContext $context)
 {
     // Check for report ID
     $reportId = $context->get('reportId');
     if (!isset($reportId) || is_null($reportId)) {
         throw new InvalidArgumentException('Missing report id.');
     }
     PHPWS_Core::initModClass('hms', 'ReportFactory.php');
     // Load the report to get its class
     try {
         $report = ReportFactory::getReportById($reportId);
     } catch (InvalidArgumentException $e) {
         NQ::simple('hms', hms\NotificationView::SUCCESS, 'Report canceled.');
         $context->goBack();
     }
     $db = new PHPWS_DB('hms_report');
     $db->addWhere('id', $reportId);
     $result = $db->delete();
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     NQ::simple('hms', hms\NotificationView::SUCCESS, 'Report canceled.');
     $cmd = CommandFactory::getCommand('ShowReportDetail');
     $cmd->setReportClass($report->getClass());
     $cmd->redirect();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:26,代码来源:CancelReportCommand.php

示例2: 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

示例3: execute

 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'RoommateProfileSearchForm.php');
     $term = $context->get('term');
     $view = new RoommateProfileSearchForm($term);
     $context->setContent($view->show());
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:7,代码来源:ShowRoommateProfileSearchCommand.php

示例4: 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) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException("{$username} tried to break roommate pairing {$roommate->id}");
     }
     $roommate->delete();
     $other = StudentFactory::getStudentByUsername($roommate->get_other_guy($username), $roommate->term);
     HMS_Activity_Log::log_activity($other->getUsername(), ACTIVITY_STUDENT_CANCELLED_ROOMMATE_REQUEST, $username, "{$username} cancelled roommate request");
     HMS_Activity_Log::log_activity($username, ACTIVITY_STUDENT_CANCELLED_ROOMMATE_REQUEST, $other->getUsername(), "{$username} cancelled roommate request");
     // Email both parties
     PHPWS_Core::initModClass('hms', 'HMS_Email.php');
     HMS_Email::send_cancel_emails($roommate);
     $name = $other->getFullName();
     NQ::Simple('hms', hms\NotificationView::SUCCESS, "You have cancelled your roommate request for {$name}.");
     $cmd = CommandFactory::getCommand('ShowStudentMenu');
     $cmd->redirect();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:28,代码来源:RoommateRequestCancelCommand.php

示例5: execute

 public function execute()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     $halls = HMS_Residence_Hall::get_halls($this->term);
     $rows = array();
     foreach ($halls as $hall) {
         if ($hall->count_avail_lottery_rooms('1') || $hall->count_avail_lottery_rooms('0')) {
             $row = array();
             $row['HALL_NAME'] = $hall->getHallName();
             $row['MALE_FREE'] = $hall->count_avail_lottery_rooms('1');
             $row['FEMALE_FREE'] = $hall->count_avail_lottery_rooms('0');
             $rooms = $hall->get_rooms();
             $roomRows = "";
             foreach ($rooms as $room) {
                 if ($room->count_avail_lottery_beds() > 0) {
                     $roomRow = "<tr><td>";
                     $roomRow = $roomRow . $room->getRoomNumber();
                     $roomRow = $roomRow . "</td><td>";
                     $roomRow = $roomRow . HMS_Util::formatGender($room->getGender());
                     $roomRow = $roomRow . "</td><td>";
                     $roomRow = $roomRow . $room->count_avail_lottery_beds();
                     $roomRow = $roomRow . "</td></tr>";
                     $roomRows = $roomRows . $roomRow;
                 }
             }
             $row['ROOMS'] = $roomRows;
             $rows[] = $row;
         }
     }
     $this->data = $rows;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:32,代码来源:ReappAvailableBeds.php

示例6: execute

 public function execute(CommandContext $context)
 {
     if (!Current_User::allow('hms', 'edit_role_members')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to edit role members.');
     }
     $username = $context->get('username');
     $rolename = $context->get('role');
     $class = $context->get('className');
     $instance = $context->get('instance');
     if (is_null($username) || is_null($rolename)) {
         echo json_encode(false);
         exit;
     }
     $db = new PHPWS_DB('hms_role');
     $db->addWhere('name', $rolename);
     $result = $db->select('row');
     if (PHPWS_Error::logIfError($result) || is_null($result['id'])) {
         echo json_encode(false);
         exit;
     }
     $role_id = $result['id'];
     $role = new HMS_Role();
     $role->id = $role_id;
     if ($role->load()) {
         echo json_encode($role->removeUser($username, $class, $instance));
         exit;
     }
     echo json_encode(false);
     exit;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:31,代码来源:RoleRemoveUserCommand.php

示例7: plugInternship

 /**
  * Loads the form's fields with the internship's information.
  * TODO: Use getter methods instead of just accessing Internship member variables directly.
  */
 public function plugInternship()
 {
     $this->plugStudent();
     $this->plugDept();
     $this->plugFaculty();
     $this->plugAgency();
     $this->plugInternInfo();
     $this->plugCourseInfo();
     // We're editing an internship...
     // If this internship's term is in the past, then replace the term list with just that term
     if (!in_array($this->intern->term, array_keys(Term::getFutureTermsAssoc()))) {
         // Remove the term dropdown and repalce it
         $this->form->dropElement('term');
         $this->form->addSelect('term', array($this->intern->term => Term::rawToRead($this->intern->term)));
         $this->form->setLabel('term', 'Select Term');
         $this->form->addCssClass('term', 'form-control');
     }
     $this->form->setMatch('term', $this->intern->term);
     $this->form->setMatch('experience_type', $this->intern->getExperienceType());
     // Plug
     $this->form->plugIn($this->formVals);
     /**
      * *
      * Emergency Contacts
      */
     //javascript('jquery');
     PHPWS_Core::initModClass('intern', 'EmergencyContactFactory.php');
     $contacts = EmergencyContactFactory::getContactsForInternship($this->intern);
     $emgContactJson = json_encode($contacts);
     Layout::add(javascriptMod('intern', 'emergencyContact', array('existing_contacts_json' => $emgContactJson)));
 }
开发者ID:sinkdb,项目名称:InternshipInventory,代码行数:35,代码来源:EditInternshipFormView.php

示例8: hms_install

function hms_install(&$content)
{
    PHPWS_Core::initModClass('users', 'Users.php');
    $DB = new PHPWS_DB('users');
    $DB->addWhere('username', 'hms_admin');
    $result = $DB->select('one');
    if ($result == null) {
        $user = new PHPWS_User();
        $user->setUsername('hms_admin');
        $user->setPassword('in the white room, with black curtains');
        $user->save();
    }
    $DB = new PHPWS_DB('users');
    $DB->addWhere('username', 'hms_student');
    $result = $DB->select('one');
    if ($result == null) {
        $user = new PHPWS_User();
        $user->setUsername('hms_student');
        $user->setPassword('shes my everything, shes my pride and joy');
        $user->save();
    }
    $directory = PHPWS_HOME_DIR . 'files/hms_reports/';
    if (!is_dir($directory)) {
        mkdir($directory);
    }
    return true;
}
开发者ID:jlbooker,项目名称:homestead,代码行数:27,代码来源:install.php

示例9: execute

 public function execute(CommandContext $context)
 {
     if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'floor_view')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do not have permission to edit floors.');
     }
     // Check for a hall ID
     $floorId = $context->get('floor');
     if (!isset($floorId)) {
         throw new InvalidArgumentException('Missing floor ID.');
     }
     PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
     PHPWS_Core::initModClass('hms', 'HMS_Floor.php');
     PHPWS_Core::initModClass('hms', 'FloorView.php');
     $floor = new HMS_Floor($floorId);
     if ($floor->term != Term::getSelectedTerm()) {
         $floorCmd = CommandFactory::getCommand('SelectFloor');
         $floorCmd->setTitle('Edit a Floor');
         $floorCmd->setOnSelectCmd(CommandFactory::getCommand('EditFloorView'));
         $floorCmd->redirect();
     }
     $hall = $floor->get_parent();
     $floorView = new FloorView($hall, $floor);
     $context->setContent($floorView->show());
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:25,代码来源:EditFloorViewCommand.php

示例10: execute

 public function execute(CommandContext $context)
 {
     $resultCmd = CommandFactory::getCommand('ShowSendRlcInvites');
     $respondByDate = $context->get('respond_by_date');
     $respondByTime = $context->get('time');
     if (!isset($respondByDate) || $respondByDate == '') {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Please choose a \'respond by\' date.');
         $resultCmd->redirect();
     }
     $dateParts = explode('/', $respondByDate);
     $respondByTimestamp = mktime($respondByTime, null, null, $dateParts[0], $dateParts[1], $dateParts[2]);
     $term = Term::getSelectedTerm();
     $studentType = $context->get('type');
     if (!isset($studentType)) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'Please choose a student type.');
         $resultCmd->redirect();
     }
     PHPWS_Core::initModClass('hms', 'RlcAssignmentFactory.php');
     PHPWS_Core::initModClass('hms', 'RlcAssignmentInvitedState.php');
     $assignments = RlcAssignmentFactory::getAssignmentsByTermStateType($term, 'new', $studentType);
     if (sizeof($assignments) == 0) {
         NQ::simple('hms', hms\NotificationView::WARNING, 'No invites needed to be sent.');
         $resultCmd->redirect();
     }
     foreach ($assignments as $assign) {
         $assign->changeState(new RlcAssignmentInvitedState($assign, $respondByTimestamp));
     }
     NQ::simple('hms', hms\NotificationView::SUCCESS, 'Learning community invites sent.');
     $resultCmd->redirect();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:30,代码来源:SendRlcInvitesCommand.php

示例11: execute

 public function execute()
 {
     PHPWS_Core::initModClass('hms', 'HousingApplication.php');
     PHPWS_Core::initModClass('hms', 'HMS_Util.php');
     // Select all cancelled apps for the given term
     $db = new PHPWS_DB('hms_new_application');
     $db->addWhere('cancelled', 1);
     $db->addWhere('term', $this->term);
     $results = $db->select();
     // Initialize storage for processed rows
     $this->rows = array();
     // Get friendly cancellation reasons from HousingApplication
     $reasons = HousingApplication::getCancellationReasons();
     // Process and store each result
     foreach ($results as $app) {
         $row = array();
         $row['bannerId'] = $app['banner_id'];
         $row['username'] = $app['username'];
         $row['gender'] = HMS_Util::formatGender($app['gender']);
         $row['application_term'] = $app['application_term'];
         $row['student_type'] = $app['student_type'];
         $row['cancelled_reason'] = $reasons[$app['cancelled_reason']];
         $row['cancelled_on'] = HMS_Util::get_long_date($app['cancelled_on']);
         $row['cancelled_by'] = $app['cancelled_by'];
         $this->rows[] = $row;
     }
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:27,代码来源:CancelledAppsList.php

示例12: execute

 public static function execute()
 {
     PHPWS_Core::initModClass('hms', 'HMS.php');
     // Copied and pasted from index.php
     require_once PHPWS_SOURCE_DIR . 'mod/hms/inc/defines.php';
     // Copied and pasted from ExecuteLotteryCommand.php
     PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
     HMS_Lottery::runLottery();
     $now = time();
     $date = date('m/d/Y H:i:s', $now);
     if ($_SESSION['UNSCHEDULE_LOTTERY']) {
         echo "Lottery has executed.  The time is {$date}.  Lottery asked to be unscheduled.\n";
     } else {
         $hr = date('H', $now);
         $day = date('d', $now);
         if ($hr >= 9 && $hr < 16) {
             $then = strtotime("16:00:00", $now);
         } else {
             if ($hr >= 16) {
                 $then = strtotime("+1 day 09:00:00", $now);
             } else {
                 $then = strtotime("09:00:00", $now);
             }
         }
         $newdate = date('m/d/Y H:i:s', $then);
         echo "Lottery has executed.  The time is {$date}.  Lottery has been scheduled to run at {$newdate}.\n";
         $sp = $this->makeClone();
         $sp->execute_at = $then;
         $sp->save();
     }
     return TRUE;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:32,代码来源:ScheduledLottery.php

示例13: getHMS

 public static function getHMS()
 {
     $rh = getallheaders();
     if (isset(HMSFactory::$hms)) {
         return HMSFactory::$hms;
     } else {
         if (isset($_REQUEST['ajax']) || !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' || isset($_REQUEST['callback']) || array_key_exists('Accept', $rh) && stripos($rh['Accept'], 'application/json') !== FALSE) {
             PHPWS_Core::initModClass('hms', 'AjaxHMS.php');
             HMSFactory::$hms = new AjaxHMS();
         } else {
             if (UserStatus::isAdmin()) {
                 PHPWS_Core::initModClass('hms', 'AdminHMS.php');
                 HMSFactory::$hms = new AdminHMS();
             } else {
                 if (UserStatus::isUser()) {
                     PHPWS_Core::initModClass('hms', 'UserHMS.php');
                     HMSFactory::$hms = new UserHMS();
                 } else {
                     // Guest
                     PHPWS_Core::initModClass('hms', 'GuestHMS.php');
                     HMSFactory::$hms = new GuestHMS();
                 }
             }
         }
     }
     return HMSFactory::$hms;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:27,代码来源:HMSFactory.php

示例14: __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

示例15: execute

 public function execute()
 {
     PHPWS_Core::initModClass('hms', 'StudentFactory.php');
     if (!isset($this->term) || is_null($this->term)) {
         throw new InvalidArgumentException('Missing term.');
     }
     $db = new PHPWS_DB('hms_new_application');
     $db->addColumn('banner_id');
     $db->addColumn('username');
     $db->addWhere('term', $this->term);
     $results = $db->select();
     if (empty($results)) {
         return;
     } elseif (PEAR::isError($results)) {
         throw new DatabaseException($results->toString());
     }
     $twentyFiveYearsAgo = strtotime("-25 years");
     foreach ($results as $student) {
         try {
             $sf = StudentFactory::getStudentByBannerId($student['banner_id'], $this->term);
             $dob = $sf->getDOB();
             if (strtotime($dob) > $twentyFiveYearsAgo) {
                 continue;
             }
             $student['dob'] = $dob;
             $student['full_name'] = $sf->getFullName();
             $this->all_rows[] = $student;
         } catch (Exception $e) {
             $student['dob'] = $student['full_name'] = null;
             $this->problems[] = $student['banner_id'];
         }
     }
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:33,代码来源:TwentyFive.php


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