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


PHP PHPWS_Core类代码示例

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


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

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

示例2: show

 public function show()
 {
     $tpl = array();
     $tpl['CHANGELOG_REPEAT'] = array();
     PHPWS_Core::initModClass('intern', 'ChangeHistoryFactory.php');
     $changes = ChangeHistoryFactory::getChangesForInternship($this->internship);
     if (is_null($changes)) {
         return "";
     }
     foreach ($changes as $change) {
         $changeFields = array();
         $changeFields['RELATIVE_DATE'] = $change->getRelativeDate();
         $changeFields['EXACT_DATE'] = $change->getFormattedDate();
         $changeFields['USERNAME'] = $change->getUsername();
         if ($change->getFromStateFriendlyname() != $change->getToStateFriendlyName()) {
             $changeFields['FROM_STATE'] = $change->getFromStateFriendlyName();
             $changeFields['TO_STATE'] = $change->getToStateFriendlyName();
         }
         $note = $change->getNote();
         if (!is_null($note)) {
             $changeFields['NOTE'] = $note;
         }
         $tpl['changelog_repeat'][] = $changeFields;
     }
     return PHPWS_Template::process($tpl, 'intern', 'changeHistory.tpl');
 }
开发者ID:jeffrafter,项目名称:InternshipInventory,代码行数:26,代码来源:ChangeHistoryView.php

示例3: runTime

 public function runTime(\Request $request)
 {
     if (\PHPWS_Core::atHome()) {
         require_once PHPWS_SOURCE_DIR . 'mod/tailgate/conf/defines.php';
         \tailgate\Controller\User\Game::userStatusSidebar();
     }
 }
开发者ID:AppStateESS,项目名称:tailgate,代码行数:7,代码来源:Module.php

示例4: execute

 public function execute(CommandContext $context)
 {
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Application.php');
     PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
     $term = $context->get('term');
     // Application must exist
     $app = HMS_RLC_Application::getApplicationByUsername(UserStatus::getUsername(), $term);
     if (is_null($app)) {
         NQ::simple('hms', hms\NotificationView::ERROR, 'No RLC application exists.');
         $context->goBack();
     } else {
         if (!HMS_RLC_Assignment::checkForAssignment(UserStatus::getUsername(), $term)) {
             // Delete the app
             $app->delete();
             // Log it
             PHPWS_Core::initModClass('hms', 'HMS_Activity_Log.php');
             HMS_Activity_Log::log_activity(UserStatus::getUsername(), ACTIVITY_RLC_APPLICATION_DELETED, UserStatus::getUsername());
             // Show a notification and go back
             NQ::simple('hms', hms\NotificationView::SUCCESS, 'RLC application deleted.');
             $context->goBack();
         } else {
             NQ::simple('hms', hms\NotificationView::WARNING, 'You have already been assigned to an RLC.');
             $context->goBack();
         }
     }
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:26,代码来源:DeleteRlcApplicationCommand.php

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

示例6: propertiesList

 protected function propertiesList($contact_id = null)
 {
     \PHPWS_Core::initModClass('properties', 'Property.php');
     $this->title = 'Property listing';
     $pager = new \DBPager('properties', 'Properties\\Property');
     if ($contact_id) {
         $pager->addWhere('contact_id', $contact_id);
         $data['is_contact'] = 1;
         $page_tags['new'] = \PHPWS_Text::moduleLink('<i class="fa fa-plus"></i> Add new property', 'properties', array('cop' => 'edit_property', 'k' => $this->contact->getKey()), null, null, 'btn btn-success');
     } else {
         $page_tags['new'] = \PHPWS_Text::secureLink('<i class="fa fa-plus"></i> Add new property', 'properties', array('aop' => 'edit_property'), null, null, 'btn btn-success');
     }
     // photo was previously uploaded
     if (!empty($_GET['pid'])) {
         $data['pid'] = $_GET['pid'];
     } else {
         $data['pid'] = 0;
     }
     javascriptMod('properties', 'photo_upload', $data);
     $pager->setSearch('name', 'company_name');
     $pager->addSortHeader('name', 'Name of property');
     $pager->addSortHeader('company_name', 'Management company');
     $pager->addSortHeader('timeout', 'Time until purge');
     $pager->setModule('properties');
     $pager->setTemplate('properties_list.tpl');
     $pager->addRowTags('row_tags', (bool) $contact_id);
     $pager->joinResult('contact_id', 'prop_contacts', 'id', 'company_name', null, true);
     $pager->addPageTags($page_tags);
     $pager->cacheQueries();
     $this->content = $pager->get();
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:31,代码来源:Base.php

示例7: __construct

 public function __construct($term)
 {
     $this->term = $term;
     echo "Term is {$term}\n\n";
     PHPWS_Core::initModClass('hms', 'RoommatePairingStrategy.php');
     PHPWS_Core::initModClass('hms', 'RequestedRoommatePairingStrategy.php');
     PHPWS_Core::initModClass('hms', 'PreferencesRoommatePairingStrategy.php');
     PHPWS_Core::initModClass('hms', 'AssignmentStrategy.php');
     PHPWS_Core::initModClass('hms', 'SpecialAssignmentStrategy.php');
     PHPWS_Core::initModClass('hms', 'SingleGenderAssignmentStrategy.php');
     PHPWS_Core::initModClass('hms', 'CoedAssignmentStrategy.php');
     PHPWS_Core::initModClass('hms', 'RandomAssignmentStrategy.php');
     # Load all the unassigned applicants for this term
     $this->applications = HousingApplication::getUnassignedFreshmenApplications($term, null);
     # Setup the pairing strategies
     $this->pairingStrategies = array();
     $this->pairingStrategies[] = new RequestedRoommatePairingStrategy($term);
     $this->pairingStrategies[] = new PreferencesRoommatePairingStrategy($term);
     # Setup the assignment strategies
     $this->assignmentStrategies = array();
     $this->assignmentStrategies[] = new SpecialAssignmentStrategy($term);
     $this->assignmentStrategies[] = new SingleGenderAssignmentStrategy($term);
     $this->assignmentStrategies[] = new CoedAssignmentStrategy($term);
     $this->assignmentStrategies[] = new RandomAssignmentStrategy($term);
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:25,代码来源:Autoassigner.php

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

示例9: 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 display confirmation screen for pairing {$roommate->id}");
     }
     $tpl = array();
     $acceptCmd = CommandFactory::getCommand('ShowRoommateConfirmAccept');
     $acceptCmd->setRoommateId($roommate->id);
     $tpl['ACCEPT'] = $acceptCmd->getURI();
     $rejectCmd = CommandFactory::getCommand('RoommateReject');
     $rejectCmd->setRoommateId($roommate->id);
     $tpl['DECLINE'] = $rejectCmd->getURI();
     $cancelCmd = CommandFactory::getCommand('ShowStudentMenu');
     $tpl['CANCEL'] = $cancelCmd->getURI();
     $requestor = StudentFactory::getStudentByUsername($roommate->requestor, $roommate->term);
     $tpl['REQUESTOR_NAME'] = $requestor->getFullName();
     $context->setContent(PHPWS_Template::process($tpl, 'hms', 'student/roommate_accept_reject_screen.tpl'));
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:29,代码来源:ShowRoommateConfirmationCommand.php

示例10: my_page

/**
 * @version $Id$
 * @author Matthew McNaney <mcnaney at gmail dot com>
 */
function my_page()
{
    $title = $content = $message = NULL;
    if (isset($_SESSION['Layout_User_Message'])) {
        $message = $_SESSION['Layout_User_Message'];
        unset($_SESSION['Layout_User_Message']);
    }
    if (isset($_SESSION['Reset_Layout'])) {
        unset($_SESSION['Reset_Layout']);
        Layout::reset();
    }
    if (isset($_REQUEST['lo_command'])) {
        $lo_command = $_REQUEST['lo_command'];
    } else {
        $lo_command = 'user_form';
    }
    switch ($lo_command) {
        case 'user_form':
            $title = dgettext('layout', 'Display settings');
            $content = Layout_User_Settings::user_form();
            break;
        case 'save_settings':
            Layout_User_Settings::save_settings();
            $_SESSION['Reset_Layout'] = 1;
            $_SESSION['Layout_User_Message'] = dgettext('layout', 'Settings saved');
            PHPWS_Core::reroute('index.php?module=users&action=user&tab=layout');
            break;
    }
    $tpl['TITLE'] = $title;
    $tpl['CONTENT'] = $content;
    $tpl['MESSAGE'] = $message;
    return PHPWS_Template::process($tpl, 'layout', 'main.tpl');
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:37,代码来源:my_page.php

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

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

示例13: forceLogin

 public function forceLogin()
 {
     if (!$this->force_login) {
         return;
     }
     PHPWS_Core::reroute($this->login_link);
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:7,代码来源:Authorization.php

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

示例15: show

 public function show()
 {
     PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
     PHPWS_Core::initModClass('hms', 'LotteryApplication.php');
     $this->setTitle('Special Interest Group');
     javascript('jquery');
     $tpl = array();
     $groups = HMS_Lottery::getSpecialInterestGroupsMap();
     // If a group was selected
     if (!is_null($this->group) && $this->group != 'none') {
         $tpl['GROUP_PAGER'] = LotteryApplication::specialInterestPager($this->group, PHPWS_Settings::get('hms', 'lottery_term'));
         $tpl['GROUP'] = $groups[$this->group];
     }
     // Show the drop down box of groups
     $form = new PHPWS_Form('special_interest');
     $form->setMethod('get');
     $form->addDropBox('group', $groups);
     $form->setClass('group', 'form-control');
     $form->setMatch('group', $this->group);
     $cmd = CommandFactory::getCommand('ShowSpecialInterestGroupApproval');
     $cmd->initForm($form);
     $form->mergeTemplate($tpl);
     $tpl = $form->getTemplate();
     return PHPWS_Template::process($tpl, 'hms', 'admin/special_interest_approval.tpl');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:25,代码来源:SpecialInterestGroupView.php


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