本文整理汇总了PHP中PHPWS_Error::log方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Error::log方法的具体用法?PHP PHPWS_Error::log怎么用?PHP PHPWS_Error::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_Error
的用法示例。
在下文中一共展示了PHPWS_Error::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: users_register
/**
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id$
*/
function users_register($module, &$content)
{
PHPWS_Core::initModClass('users', 'Permission.php');
PHPWS_Core::initModClass('users', 'My_Page.php');
$no_permissions = $no_my_page = FALSE;
$result = Users_Permission::createPermissions($module);
if (is_null($result)) {
PHPWS_Boost::addLog('users', dgettext('users', 'Permissions file not implemented.'));
$content[] = dgettext('users', 'Permissions file not implemented.');
$no_permissions = TRUE;
} elseif (PHPWS_Error::isError($result)) {
$content[] = dgettext('users', 'Permissions table not created successfully.');
PHPWS_Error::log($result);
return FALSE;
} else {
$content[] = dgettext('users', 'Permissions table created successfully.');
}
$result = My_Page::registerMyPage($module);
if (PHPWS_Error::isError($result)) {
PHPWS_Boost::addLog('users', dgettext('users', 'A problem occurred when trying to register this module to My Page.'));
$content[] = dgettext('users', 'A problem occurred when trying to register this module to My Page.');
return FALSE;
} elseif ($result != FALSE) {
$content[] = dgettext('users', 'My Page registered to Users module.');
} else {
$no_my_page = TRUE;
}
// If the module doesn't have permissions or a My Page
// then don't register the module
if ($no_permissions && $no_my_page) {
return FALSE;
} else {
return TRUE;
}
}
示例2: execute
/**
* Exec
*
* @param CommandContext $context
* @throws InvalidArgumentExection
*/
public function execute(CommandContext $context)
{
if (!Current_User::allow('hms', 'reports')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do no have permission to run reports.');
}
$reportId = $context->get('reportId');
if (!isset($reportId) || is_null($reportId)) {
throw new InvalidArgumentExection('Missing report id.');
}
// Instantiate the report controller with the requested report id
PHPWS_Core::initModClass('hms', 'ReportFactory.php');
$report = ReportFactory::getReportById($reportId);
// Check to make sure the file exists
if (!file_exists($report->getCsvOutputFilename())) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Could not open report file.');
PHPWS_Error::log('Could not open report file ' . $report->getCsvOutputFilename(), 'hms');
$reportCmd = CommandFactory::getCommand('ShowReportDetail');
$reportCmd->setReportClass($report->getClass());
$reportCmd->redirect();
}
$pdf = file_get_contents($report->getCsvOutputFilename());
// Hoepfully force the browser to open a 'save as' dialogue
header('Content-Type: text/csv');
header('Cache-Control: public, must-revalidate, max-age=0');
// HTTP/1.1
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
// Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Content-Length: ' . strlen($pdf));
header('Content-Disposition: attachment; filename="' . basename($report->getCsvOutputFilename()) . '";');
echo $pdf;
exit;
}
示例3: execute
/**
* Shows the requested report's HTML output.
*
* @param CommandContext $context
* @throws InvalidArgumentExection
*/
public function execute(CommandContext $context)
{
if (!Current_User::allow('hms', 'reports')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do no have permission to run reports.');
}
$reportId = $context->get('reportId');
if (!isset($reportId) || is_null($reportId)) {
throw new InvalidArgumentExection('Missing report id.');
}
// Instantiate the report controller with the requested report id
PHPWS_Core::initModClass('hms', 'ReportFactory.php');
$report = ReportFactory::getReportById($reportId);
Layout::addPageTitle($report->getFriendlyName());
$detailCmd = CommandFactory::getCommand('ShowReportDetail');
$detailCmd->setReportClass($report->getClass());
$content = '<div> ' . $detailCmd->getLink('« back') . ' </div>';
$content .= file_get_contents($report->getHtmlOutputFilename());
if ($content === FALSE) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Could not open report file.');
PHPWS_Error::log('Could not open report file ' . $report->getCsvOutputFilename(), 'hms');
$reportCmd = CommandFactory::getCommand('ShowReportDetail');
$reportCmd->setReportClass($report->getClass());
$reportCmd->redirect();
}
$context->setContent($content);
}
示例4: __construct
public function __construct($name = NULL, $data = NULL, $id = NULL, $type = NULL)
{
$editorList = $this->getEditorList();
if (PHPWS_Error::isError($editorList)) {
PHPWS_Error::log($editorList);
$this->type = null;
return;
}
if (empty($type)) {
$type = $this->getUserType();
}
$this->editorList = $editorList;
if (isset($type)) {
$result = $this->setType($type);
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$this->type = null;
return;
}
}
if (isset($id)) {
$this->id = $id;
}
if (isset($name)) {
$this->setName($name);
if (empty($this->id)) {
$this->id = $name;
}
}
if (isset($data)) {
$this->setData(trim($data));
}
}
示例5: menu_unregister_key
/**
* unregisters deleted keys from menu
*
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id$
*/
function menu_unregister_key(Key $key)
{
PHPWS_Core::initModClass('menu', 'Menu_Link.php');
if (empty($key) || empty($key->id)) {
return FALSE;
}
$db = new PHPWS_DB('menu_links');
$db->addWhere('key_id', $key->id);
$result = $db->delete();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
}
$db2 = new PHPWS_DB('menu_assoc');
$db2->addWhere('key_id', $key->id);
$result = $db2->delete();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
}
$db3 = new PHPWS_DB('menus');
$db3->addWhere('assoc_key', $key->id);
$db3->addValue('assoc_key', 0);
$db3->addValue('assoc_url', null);
$db3->update();
return true;
}
示例6: logIfError
public static function logIfError($item)
{
if (PHPWS_Error::isError($item)) {
PHPWS_Error::log($item);
return true;
} else {
return false;
}
}
示例7: 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();
}
示例8: calendar_uninstall
/**
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id$
*/
function calendar_uninstall(&$content)
{
PHPWS_Core::initModClass('calendar', 'Schedule.php');
// Need functions to remove old event tables
$db = new PHPWS_DB('calendar_schedule');
$schedules = $db->getObjects('Calendar_Schedule');
if (PHPWS_Error::isError($schedules)) {
return $schedules;
} elseif (empty($schedules)) {
$result = PHPWS_DB::dropTable('calendar_schedule');
if (PHPWS_Error::isError($result)) {
return $result;
}
$result = PHPWS_DB::dropTable('calendar_notice');
if (PHPWS_Error::isError($result)) {
return $result;
}
$result = PHPWS_DB::dropTable('calendar_suggestions');
if (PHPWS_Error::isError($result)) {
return $result;
}
return true;
}
$error = false;
foreach ($schedules as $sch) {
$result = $sch->delete();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$error = true;
}
}
$result = PHPWS_DB::dropTable('calendar_schedule');
if (PHPWS_Error::isError($result)) {
return $result;
}
$result = PHPWS_DB::dropTable('calendar_notice');
if (PHPWS_Error::isError($result)) {
return $result;
}
$result = PHPWS_DB::dropTable('calendar_suggestions');
if (PHPWS_Error::isError($result)) {
return $result;
}
if (PHPWS_DB::isTable('converted')) {
$db2 = new PHPWS_DB('converted');
$db2->addWhere('convert_name', array('schedule', 'calendar'));
$db2->delete();
$content[] = dgettext('calendar', 'Removed convert flag.');
}
if (!$error) {
$content[] = dgettext('calendar', 'Calendar tables removed.');
} else {
$content[] = dgettext('calendar', 'Some errors occurred when uninstalling Calendar.');
}
return true;
}
示例9: __construct
public function __construct($id = null)
{
if (!isset($id)) {
return;
}
$this->setId($id);
$result = $this->init();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
}
}
示例10: rss_unregister
/**
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id$
*/
function rss_unregister($module, &$content)
{
$db = new PHPWS_DB('rssfeeds');
$db->addWhere('module', $module);
$result = $db->delete();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$content[] = dgettext('rss', 'An error occurred trying to unregister this module from RSSFeeds.');
return FALSE;
} else {
$content[] = dgettext('rss', 'Module unregistered from RSSFeeds.');
return TRUE;
}
}
示例11: menu_install
/**
* @author Matthew McNaney <mcnaney at gmail dot com>
* @version $Id$
*/
function menu_install(&$content)
{
PHPWS_Core::initModClass('menu', 'Menu_Item.php');
$menu = new Menu_Item();
$menu->title = dgettext('menu', 'Main menu');
$menu->template = 'basic';
$menu->pin_all = 1;
$result = $menu->save();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
return false;
} else {
$content[] = dgettext('menu', 'Default menu created successfully.');
return true;
}
}
示例12: userOption
public function userOption($module_title)
{
$module = new PHPWS_Module($module_title);
$directory = $module->getDirectory();
$final_file = $directory . 'inc/my_page.php';
if (!is_file($final_file)) {
PHPWS_Error::log(PHPWS_FILE_NOT_FOUND, 'users', 'userOption', $final_file);
return dgettext('users', 'There was a problem with this module\'s My Page file.');
}
include $final_file;
if (!function_exists('my_page')) {
return PHPWS_Error::get(USER_MISSING_MY_PAGE, 'users', 'My_Page::userOption', $module_title);
}
$content = my_page();
return $content;
}
示例13: __construct
public function __construct($id = 0)
{
if (empty($id)) {
$this->start_time = PHPWS_Time::getUserTime();
$this->end_time = PHPWS_Time::getUserTime();
return;
} else {
$this->id = (int) $id;
$result = $this->init();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
$this->id = 0;
} elseif (!$result) {
$this->id = 0;
}
}
}
示例14: registerModule
public static function registerModule($module, &$content)
{
if (is_file(PHPWS_SOURCE_DIR . 'mod/' . $module . '/conf/rss.php')) {
$reg_file = PHPWS_Core::getConfigFile($module, 'rss.php');
} else {
$reg_file = false;
}
if ($reg_file == FALSE) {
PHPWS_Boost::addLog($module, dgettext('rss', 'No RSS file found.'));
return FALSE;
}
PHPWS_Core::initModClass('rss', 'Channel.php');
include $reg_file;
$oChannel = new RSS_Channel();
$oChannel->module = $module;
if (!isset($channel) || !is_array($channel)) {
$content[] = dgettext('rss', 'RSS file found but no channel information.');
PHPWS_Boost::addLog($module, dgettext('rss', 'RSS file found but no channel information.'));
}
$oModule = new PHPWS_Module($module);
if (!empty($channel['title'])) {
$oChannel->title = strip_tags($channel['title']);
} else {
$oChannel->title = $oModule->proper_name;
}
if (!empty($channel['description'])) {
$oChannel->description = strip_tags($channel['description']);
}
if (!empty($channel['link'])) {
$oChannel->link = strip_tags($channel['link']);
} else {
$oChannel->link = PHPWS_Core::getHomeHttp();
}
$result = $oChannel->save();
if (PHPWS_Error::isError($result)) {
PHPWS_Error::log($result);
PHPWS_Boost::addLog($module, dgettext('rss', 'An error occurred registering to RSS module.'));
$content[] = dgettext('rss', 'An error occurred registering to RSS module.');
return NULL;
} else {
$content[] = sprintf(dgettext('rss', 'RSS registration to %s module successful.'), $oModule->proper_name);
return TRUE;
}
}
示例15: sendEmail
public static function sendEmail($to, $from, $subject, $content, $cc = NULL, $bcc = NULL)
{
$settings = InternSettings::getInstance();
// Sanity checking
if (!isset($to) || is_null($to)) {
return false;
}
if (!isset($from) || is_null($from)) {
$from = $settings->getSystemName() . ' <' . $settings->getEmailFromAddress() . '>';
}
if (!isset($subject) || is_null($subject)) {
return false;
}
if (!isset($content) || is_nulL($content)) {
return false;
}
// Create a Mail object and set it up
PHPWS_Core::initCoreClass('Mail.php');
$message = new PHPWS_Mail();
$message->addSendTo($to);
$message->setFrom($from);
$message->setSubject($subject);
$message->setMessageBody($content);
if (isset($cc)) {
$message->addCarbonCopy($cc);
}
if (isset($bcc)) {
$message->addBlindCopy($bcc);
}
// Send the message
if (EMAIL_TEST_FLAG) {
$result = true;
} else {
$result = $message->send();
}
if (PEAR::isError($result)) {
PHPWS_Error::log($result);
return false;
}
self::logEmail($message);
return true;
}