本文整理汇总了PHP中PHPWS_Settings类的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Settings类的具体用法?PHP PHPWS_Settings怎么用?PHP PHPWS_Settings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PHPWS_Settings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: searchBox
public static function searchBox()
{
if (SEARCH_DEFAULT) {
$onclick = sprintf('onclick="if(this.value == \'%s\')this.value = \'\';"', SEARCH_DEFAULT);
}
PHPWS_Core::initCoreClass('Form.php');
$form = new PHPWS_Form('search_box');
$form->setProtected(false);
$form->setMethod('get');
$form->addHidden('module', 'search');
$form->addHidden('user', 'search');
$form->addText('search', SEARCH_DEFAULT);
$form->setLabel('search', dgettext('search', 'Search'));
if (PHPWS_Settings::get('search', 'show_alternates')) {
Search_User::addAlternates($form);
}
if (isset($onclick)) {
$form->setExtra('search', $onclick);
}
$form->addSubmit('go', dgettext('search', 'Search'));
$mod_list = Search_User::getModList();
$form->addSelect('mod_title', $mod_list);
$key = Key::getCurrent();
if (!empty($key) && !$key->isDummy()) {
$form->setMatch('mod_title', $key->module);
} elseif (isset($_REQUEST['mod_title'])) {
$form->setMatch('mod_title', $_REQUEST['mod_title']);
}
$template = $form->getTemplate();
$content = PHPWS_Template::process($template, 'search', 'search_box.tpl');
Layout::add($content, 'search', 'search_box');
}
示例2: 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');
}
示例3: getVotingData
private function getVotingData()
{
$election = Factory::getCurrent();
// If there's no election going on, then return empty data
if (empty($election)) {
return array('hasVoted' => false, 'election' => null, 'single' => array(), 'multiple' => array(), 'referendum' => array(), 'unqualified' => array());
}
// Check if student has voted already
$hasVoted = $this->student->hasVoted($election['id']);
// If already voted, return minimal voting info
if ($hasVoted) {
return array('hasVoted' => true, 'election' => $election, 'single' => array(), 'multiple' => array(), 'referendum' => array(), 'unqualified' => array());
}
// Assemble the voting data
$single = \election\Factory\Single::getListWithTickets($election['id']);
$multiple = \election\Factory\Multiple::getListWithCandidates($election['id']);
if (!empty($multiple)) {
$unqualified = \election\Factory\Multiple::filter($multiple, $this->student);
} else {
$unqualified = array();
}
$referendum = \election\Factory\Referendum::getList($election['id']);
$voting_data = array('hasVoted' => false, 'election' => $election, 'single' => $single, 'multiple' => $multiple, 'referendum' => $referendum, 'unqualified' => $unqualified, 'supportLink' => \PHPWS_Settings::get('election', 'supportLink'));
return $voting_data;
}
示例4: show
public function show()
{
PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
$tpl = array();
$form = new PHPWS_Form();
$submitCmd = CommandFactory::getCommand('LotterySettingsSubmit');
$submitCmd->initForm($form);
$form->addDropBox('lottery_term', Term::getTermsAssoc());
$form->setMatch('lottery_term', PHPWS_Settings::get('hms', 'lottery_term'));
$form->setLabel('lottery_term', 'Lottery Term');
$form->setClass('lottery_term', 'form-control');
$form->addText('hard_cap');
$form->setLabel('hard_cap', 'Max # Returning Students (hard cap):');
$form->setValue('hard_cap', PHPWS_Settings::get('hms', 'lottery_hard_cap'));
$form->setClass('hard_cap', 'form-control');
/*
$form->addText('soph_goal');
$form->setLabel('soph_goal', 'Sophomores:');
$form->setValue('soph_goal', PHPWS_Settings::get('hms', 'lottery_soph_goal'));
*/
$form->addText('jr_goal');
$form->setLabel('jr_goal', 'Juniors:');
$form->setValue('jr_goal', PHPWS_Settings::get('hms', 'lottery_jr_goal'));
$form->setClass('jr_goal', 'form-control');
$form->addText('sr_goal');
$form->setLabel('sr_goal', 'Senior:');
$form->setValue('sr_goal', PHPWS_Settings::get('hms', 'lottery_sr_goal'));
$form->setClass('sr_goal', 'form-control');
$form->addSubmit('submit', 'Save');
$form->mergeTemplate($tpl);
Layout::addPageTitle("Lottery Settings");
return PHPWS_Template::process($form->getTemplate(), 'hms', 'admin/lottery_settings.tpl');
}
示例5: getMenuBlockView
public function getMenuBlockView(Student $student)
{
PHPWS_Core::initModClass('hms', 'ReapplicationWaitingListMenuBlockView.php');
PHPWS_Core::initModClass('hms', 'HousingApplication.php');
$term = PHPWS_Settings::get('hms', 'lottery_term');
$application = HousingApplication::getApplicationByUser(UserStatus::getUsername(), $term, 'lottery');
return new ReapplicationWaitingListMenuBlockView($this->term, $this->getStartDate(), $this->getEndDate(), $application);
}
示例6: propertiesLoginLink
function propertiesLoginLink()
{
$login = \PHPWS_Settings::get('properties', 'login_link');
if (empty($login)) {
$login = './admin';
}
return $login;
}
示例7: __construct
/**
* @param string $currentUserName - Username of the user currently logged in. Will be sent to web service
*/
public function __construct($currentUserName)
{
$this->currentUserName = $currentUserName;
// Get the WSDL URI from module's settings
$wsdlUri = \PHPWS_Settings::get('intern', 'wsdlUri');
// Create the SOAP instance
$this->client = new \SoapClient($wsdlUri, array('WSDL_CACHE_MEMORY'));
}
示例8: 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();
}
示例9: __construct
public function __construct()
{
$this->apiUrl = \PHPWS_Settings::get('election', 'studentOrgApiUrl');
if (is_null($this->apiUrl)) {
throw new \InvalidArgumentException('Student org API url is not configured.');
}
// Create a Guzzle instance
$this->client = new Client($this->apiUrl, array('request.options' => array('verify' => false)));
}
示例10: execute
public function execute(CommandContext $context)
{
PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
PHPWS_Core::initModClass('hms', 'LotteryDenyRoommateRequestView.php');
$request = HMS_Lottery::get_lottery_roommate_invite_by_id($context->get('requestId'));
$term = PHPWS_Settings::get('hms', 'lottery_term');
$view = new LotteryDenyRoommateRequestView($request, $term);
$context->setContent($view->show());
}
示例11: execute
public function execute(CommandContext $context)
{
$roomId = $context->get('roomId');
$roommates = $context->get('roommates');
$mealPlan = $context->get('mealPlan');
$term = PHPWS_Settings::get('hms', 'lottery_term');
PHPWS_Core::initModClass('hms', 'LotteryConfirmView.php');
$view = new LotteryConfirmView($roomId, $mealPlan, $roommates, $term);
$context->setContent($view->show());
}
示例12: show
public function show()
{
$basePath = PHPWS_Settings::get('faxmaster', 'fax_path');
if (is_null($basePath) || !isset($basePath)) {
throw new InvalidArgumentException('Please set fax_path setting.');
}
header('Content-Disposition: attachment; filename="' . $this->fax->getFileName() . '"');
readfile($basePath . $this->fax->getFileName());
exit;
}
示例13: faxmaster_update
/**
* update.php - FaxMaster update script
*
*/
function faxmaster_update(&$content, $currentVersion)
{
switch ($currentVersion) {
case version_compare($currentVersion, '0.1.0', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/faxmaster/boost/update-0.1.1.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.1.2', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/faxmaster/boost/update-0.1.2.sql');
if (PEAR::isError($result)) {
return $result;
}
case version_compare($currentVersion, '0.1.3', '<'):
PHPWS_Core::initModClass('users', 'Permission.php');
Users_Permission::registerPermissions('faxmaster', $content);
case version_compare($currentVersion, '0.1.5', '<'):
PHPWS_Settings::set('faxmaster', 'fax_path', '/var/fax/');
PHPWS_Settings::save('faxmaster');
case version_compare($currentVersion, '0.1.6', '<'):
$content[] = '<pre>';
slcUpdateFiles(array('class/FaxPager.php', 'class/Faxmaster.php', 'templates/faxList.tpl', 'templates/style.css', 'templates/statistics.tpl'), $content);
$content[] = '0.1.6 Changes
---------------
+ Added a statistics page to view monthly fax stats.
+ Added CSV export to the new statistics page.</pre>';
case version_compare($currentVersion, '0.1.7', '<'):
$content[] = '<pre>';
// Add 2 new columns to the database related to archiving
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/faxmaster/boost/update-0.1.7.sql');
if (PEAR::isError($result)) {
return $result;
}
slcUpdateFiles(array('boost/boost.php', 'boost/install.sql', 'boost/permission.php', 'boost/update.php', 'boost/update-0.1.7.sql', 'class/ArchiveDownload.php', 'class/exception/InstallException.php', 'class/Fax.php', 'class/FaxPager.php', 'class/Faxmaster.php', 'inc/settings.php', 'templates/archivePager.tpl', 'templates/faxList.tpl', 'templates/settings.tpl', 'templates/style.css'), $content);
$content[] = '0.1.7 Changes
---------------
+ Added an archive method that is only accessbile by URL.
+ Added the ability to Download an Archive file.
+ Added permissions related to archiving and settings.
+ Added 2 database columns needed for archiving.
+ Added a View Archive page to view a list of all archived faxes.
+ Added a Settings page to configure the fax and archive paths.
</pre>';
case version_compare($currentVersion, '0.1.8', '<'):
$db = new PHPWS_DB();
$result = $db->importFile(PHPWS_SOURCE_DIR . 'mod/faxmaster/boost/update-0.1.8.sql');
if (PEAR::isError($result)) {
return $result;
}
}
return true;
}
示例14: show
public function show()
{
$basePath = PHPWS_Settings::get('faxmaster', 'archive_path');
if (is_null($basePath) || !isset($basePath)) {
throw new InvalidArgumentException('Please set archive_path setting.');
}
header('Content-Type: application/x-gtar');
header('Content-Disposition: attachment; filename="' . $this->tar . '"');
header('Content-Length: ' . filesize($basePath . $this->tar));
readfile($basePath . $this->tar);
exit;
}
示例15: showForStudent
public function showForStudent(Student $student, $term)
{
// for freshmen
if ($student->getApplicationTerm() > Term::getCurrentTerm()) {
return true;
}
// for returning students (summer terms)
if ($term > $student->getApplicationTerm() && $term != PHPWS_Settings::get('hms', 'lottery_term') && (Term::getTermSem($term) == TERM_SUMMER1 || Term::getTermSem($term) == TERM_SUMMER2)) {
return true;
}
return false;
}