本文整理汇总了PHP中PHPWS_DB::addWhere方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_DB::addWhere方法的具体用法?PHP PHPWS_DB::addWhere怎么用?PHP PHPWS_DB::addWhere使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPWS_DB
的用法示例。
在下文中一共展示了PHPWS_DB::addWhere方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showFP
function showFP()
{
$db = new PHPWS_DB('ps_page');
$db->addWhere('front_page', 1);
if ($db->isTableColumn('deleted')) {
$db->addWhere('deleted', 0);
}
Key::restrictView($db, 'pagesmith');
$db->loadClass('pagesmith', 'PS_Page.php');
$result = $db->getObjects('PS_Page');
if (!PHPWS_Error::logIfError($result) && !empty($result)) {
PHPWS_Core::initModClass('pagesmith', 'PageSmith.php');
foreach ($result as $page) {
$content = $page->view();
if ($content && !PHPWS_Error::logIfError($content)) {
if (Current_User::allow('pagesmith', 'edit_page', $page->id)) {
$content .= sprintf('<p class="pagesmith-edit">%s</p>', $page->editLink());
}
Layout::add($content, 'pagesmith', 'view_' . $page->id, TRUE);
}
}
} else {
return null;
}
}
示例2: 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;
}
}
示例3: execute
public function execute()
{
PHPWS_Core::initModClass('hms', 'HousingApplication.php');
$this->reasons = HousingApplication::getCancellationReasons();
// All students
$db = new PHPWS_DB('hms_new_application');
$db->addColumn('cancelled_reason');
$db->addColumn('id', null, 'ount', true);
$db->addWhere('term', $this->getTerm());
$db->addWhere('cancelled', 1);
$db->addGroupBy('cancelled_reason');
$this->reasonCounts = $db->select('assoc');
// Freshmen
$db = new PHPWS_DB('hms_new_application');
$db->addColumn('cancelled_reason');
$db->addColumn('id', null, 'count', true);
$db->addWhere('term', $this->getTerm());
$db->addWhere('cancelled', 1);
$db->addWhere('student_type', TYPE_FRESHMEN);
$db->addGroupBy('cancelled_reason');
$this->freshmenReasonCounts = $db->select('assoc');
// Continuing
$db = new PHPWS_DB('hms_new_application');
$db->addColumn('cancelled_reason');
$db->addColumn('id', null, 'count', true);
$db->addWhere('term', $this->getTerm());
$db->addWhere('cancelled', 1);
$db->addWhere('student_type', TYPE_CONTINUING);
$db->addGroupBy('cancelled_reason');
$this->continuingReasonCounts = $db->select('assoc');
}
示例4: execute
public function execute()
{
PHPWS_Core::initModClass('hms', 'HMS_Util.php');
$term = $this->term;
$db = new PHPWS_DB('hms_checkin');
// Join hall structure
$db->addJoin('', 'hms_checkin', 'hms_hall_structure', 'bed_id', 'bedid');
$db->addColumn('hms_checkin.banner_id');
$db->addColumn('hms_checkin.checkin_date');
$db->addColumn('hms_hall_structure.hall_name');
$db->addColumn('hms_hall_structure.room_number');
$db->addWhere('hms_checkin.term', $term);
$db->addWhere('hms_checkin.checkout_date', null, 'IS NULL');
// Sort by hall, then room number
$db->addOrder(array('hms_hall_structure.hall_name ASC', 'hms_hall_structure.room_number ASC'));
$results = $db->select();
if (PHPWS_Error::isError($results)) {
throw new DatabaseException($results->toString());
}
// Post-processing, cleanup, making it pretty
foreach ($results as $row) {
// Updates counts
$this->total++;
$row['checkin_date'] = HMS_Util::get_short_date_time($row['checkin_date']);
// Copy the cleaned up row to the member var for data
$this->data[] = $row;
}
}
示例5: execute
/**
* Executes this pulse. Checks for any pending reports and runs them.
*/
public static function execute()
{
// Reschedule the next run of this process
/*
$sp = $this->makeClone();
$sp->execute_at = strtotime("+1 minutes");
$sp->save();
*
*/
// Load necessary classes
PHPWS_Core::initModClass('hms', 'UserStatus.php');
PHPWS_Core::initModClass('hms', 'ReportFactory.php');
PHPWS_Core::initModCLass('hms', 'HMS_Email.php');
// Fake a user, in case we need that
UserStatus::wearMask('HMS System');
// Check for any pending reports (scheduled for any time up until now)
$db = new PHPWS_DB('hms_report');
$db->addWhere('completed_timestamp', null, 'IS');
// not completed
$db->addWhere('began_timestamp', null, 'IS');
// not already running somewhere
$db->addWhere('scheduled_exec_time', time(), '<=');
// scheduled exec time is now or before
$db->addOrder('scheduled_exec_time ASC');
// Run in order scheduled
$results = $db->select();
// If there's nothing to do, quite nicely
if (!isset($results) || is_null($results) || empty($results)) {
UserStatus::removeMask();
return 'No reports waiting.';
}
// Run each report
foreach ($results as $row) {
$report = null;
try {
// Load the proper controller for this report
$reportCtrl = ReportFactory::getControllerById($row['id']);
// Load this report's params
$reportCtrl->loadParams();
// Generate the report
$reportCtrl->generateReport();
$report = $reportCtrl->getReport();
} catch (Exception $e) {
// handle the exception nicely
self::emailError(self::formatException($e));
exit;
}
// Send success notification
$username = $report->getCreatedBy();
if ($username == 'jbooker') {
$username = 'jb67803';
}
HMS_Email::sendReportCompleteNotification($username, $report->getFriendlyName());
}
// Remove the mask
UserStatus::removeMask();
// Exit cleanly
return;
}
示例6: execute
public function execute()
{
$db = new PHPWS_DB('hms_new_application');
$db->addColumn('student_type');
$db->addColumn('id', null, 'count', true);
$db->addWhere('term', $this->getTerm());
$db->addWhere('cancelled', 1);
$db->addGroupBy('student_type');
$this->typeCounts = $db->select('assoc');
}
示例7: checkForWaiver
public static function checkForWaiver($username, $term = NULL)
{
$db = new PHPWS_DB('hms_eligibility_waiver');
$db->addWhere('asu_username', $username);
if (!isset($term)) {
$db->addWhere('term', Term::getCurrentTerm());
} else {
$db->addWhere('term', $term);
}
return !is_null($db->select('row'));
}
示例8: getAssignmentsByTermStateType
public static function getAssignmentsByTermStateType($term, $state, $type)
{
$db = new PHPWS_DB('hms_learning_community_applications');
$db->addColumn('hms_learning_community_applications.*');
$db->addColumn('hms_learning_community_assignment.*');
$db->addJoin('', 'hms_learning_community_applications', 'hms_learning_community_assignment', 'id', 'application_id');
$db->addWhere('term', $term);
$db->addWhere('hms_learning_community_assignment.state', $state);
$db->addWhere('application_type', $type);
return $db->getObjects('HMS_RLC_Assignment');
}
示例9: getUserRolesForInstance
public static function getUserRolesForInstance($instance)
{
$db = new PHPWS_DB('hms_user_role');
$db->addWhere('hms_user_role.class', strtolower(get_class($instance)));
$db->addWhere('hms_user_role.instance', $instance->id);
$result = $db->select();
if (PHPWS_Error::logIfError($result)) {
throw new DatabaseException($result->toString());
}
return $result;
}
示例10: getRoomByPersistentId
public static function getRoomByPersistentId($roomId, $term)
{
$db = new PHPWS_DB('hms_room');
$db->addWhere('term', $term);
$db->addWhere('persistent_id', $roomId);
$room = new HMS_Room(0);
$result = $db->loadObject($room);
if (PHPWS_Error::logIfError($result)) {
throw new DatabaseException($result->toString());
}
return $room;
}
示例11: execute
public function execute()
{
PHPWS_Core::initModClass('hms', 'HousingApplicationFactory.php');
PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
$db = new PHPWS_DB('hms_new_application');
$db->addColumn('hms_new_application.*');
$db->addWhere('term', $this->term);
$db->addWhere('cancelled', 0);
$term = Term::getTermSem($this->term);
if ($term == TERM_FALL) {
$db->addJoin('LEFT', 'hms_new_application', 'hms_fall_application', 'id', 'id');
$db->addColumn('hms_fall_application.*');
} else {
if ($term == TERM_SUMMER1 || $term == TERM_SUMMER2) {
$db->addJoin('LEFT', 'hms_new_application', 'hms_summer_application', 'id', 'id');
$db->addColumn('hms_summer_application.*');
}
}
$result = $db->select();
$app = array();
foreach ($result as $app) {
$username = $app['username'];
$bannerId = $app['banner_id'];
$type = $app['student_type'];
$cellPhone = $app['cell_phone'];
$date = date('n/j/Y', $app['created_on']);
$assignment = HMS_Assignment::getAssignmentByBannerId($bannerId, $this->term);
if (!is_null($assignment)) {
$room = $assignment->where_am_i();
} else {
$room = '';
}
$student = StudentFactory::getStudentByBannerId($bannerId, $this->term);
$first = $student->getFirstName();
$middle = $student->getMiddleName();
$last = $student->getLastName();
$gender = $student->getPrintableGender();
$birthday = date("m/d/Y", $student->getDobDateTime()->getTimestamp());
$address = $student->getAddress(NULL);
if ($term == TERM_SPRING || $term == TERM_FALL) {
$lifestyle = $app['lifestyle_option'] == 1 ? 'Single Gender' : 'Co-Ed';
} else {
$lifestyle = $app['room_type'] == 1 ? 'Single Room' : 'Double Room';
}
if (!is_null($address) && $address !== false) {
$this->rows[] = array($username, $bannerId, $first, $middle, $last, $gender, $type, $cellPhone, $room, $date, $address->line1, $address->line2, $address->line3, $address->city, $address->state, $address->zip, $birthday, $lifestyle);
} else {
$this->rows[] = array($username, $bannerId, $first, $middle, $last, '', $type, $cellPhone, $room, $date, '', '', '', '', '', '', $lifestyle);
}
}
}
示例12: execute
public function execute()
{
$db = new PHPWS_DB('hms_room');
$db->addColumn('hms_residence_hall.hall_name');
$db->addColumn('hms_floor.floor_number');
$db->addColumn('hms_room.room_number');
$db->addJoin('LEFT', 'hms_room', 'hms_floor', 'floor_id', 'id');
$db->addJoin('LEFT', 'hms_floor', 'hms_residence_hall', 'residence_hall_id', 'id');
$db->addWhere('hms_room.term', $this->term);
$db->addWhere('hms_room.gender_type', COED);
$results = $db->select();
$this->totalCoed = sizeof($results);
$this->rows = $results;
}
示例13: getSubjects
public static function getSubjects($mustIncludeId = null)
{
$subjects = array('-1' => 'Select a subject...');
$db = new PHPWS_DB('intern_subject');
$db->addWhere('active', 1, '=', 'OR');
if (!is_null($mustIncludeId)) {
$db->addWhere('id', $mustIncludeId, '=', 'OR');
}
$db->addOrder('abbreviation ASC');
$results = $db->select();
foreach ($results as $row) {
$subjects[$row['id']] = $row['abbreviation'] . ' - ' . $row['description'];
}
return $subjects;
}
示例14: getDamagesBefore
/**
* Returns the set of RoomDamage objects that were created before
* the give timestmap.
*
* @param HMS_Room $room
* @param unknown $timestamp
* @throws DatabaseException
* @throws InvalidArgumentException
* @return Array<RoomDamage> null
*/
public static function getDamagesBefore(HMS_Room $room, $timestamp)
{
if (!isset($timestamp)) {
throw new InvalidArgumentException('Missing timestamp.');
}
$db = new PHPWS_DB('hms_room_damage');
$db->addWhere('room_persistent_id', $room->getPersistentId());
$db->addWhere('repaired', 0);
$db->addWhere('reported_on', $timestamp, '<=');
$result = $db->getObjects('RoomDamageDb');
if (PHPWS_Error::logIfError($result)) {
throw new DatabaseException($result->toString());
}
return $result;
}
示例15: 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;
}