Example #1
0
 function WikiPage($id = NULL)
 {
     if (isset($id)) {
         $db = new PHPWS_DB('wiki_pages');
         /* Check if page id or page title */
         if (is_numeric($id)) {
             $this->setId($id);
             $db->loadObject($this);
         } else {
             $db->addWhere('title', $id);
             if (!$db->loadObject($this)) {
                 $this->setTitle($id);
             }
         }
     }
 }
Example #2
0
 public function init()
 {
     if (empty($this->id)) {
         return false;
     }
     $db = new PHPWS_DB('multimedia');
     return $db->loadObject($this);
 }
Example #3
0
 public function init()
 {
     $db = new PHPWS_DB('controlpanel_link');
     $result = $db->loadObject($this);
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
 }
Example #4
0
 public function init()
 {
     $db = new PHPWS_DB('checkin_staff');
     $db->addJoin('left', 'checkin_staff', 'users', 'user_id', 'id');
     $db->addColumn('users.display_name');
     $db->addColumn('*');
     return $db->loadObject($this);
 }
Example #5
0
 public function init()
 {
     $db = new PHPWS_DB('folders');
     $result = $db->loadObject($this);
     if (PHPWS_Error::isError($result)) {
         $this->_error = $result;
     }
 }
Example #6
0
 function OldWikiPage($id = NULL)
 {
     if (isset($id) && is_numeric($id)) {
         $this->setId($id);
         $db = new PHPWS_DB('wiki_pages_version');
         PHPWS_Error::logIfError($db->loadObject($this));
     }
 }
Example #7
0
 function WikiImage($id = NULL)
 {
     if (!empty($id)) {
         $this->setId($id);
         $db = new PHPWS_DB('wiki_images');
         PHPWS_Error::logIfError($db->loadObject($this));
     }
 }
Example #8
0
 public function init()
 {
     if (empty($this->id)) {
         return FALSE;
     }
     $db = new PHPWS_DB('block');
     return $db->loadObject($this);
 }
Example #9
0
 public function init()
 {
     $DB = new PHPWS_DB('controlpanel_tab');
     $result = $DB->loadObject($this);
     if (PHPWS_Error::logIfError($result) || !$result) {
         $this->id = null;
     }
 }
Example #10
0
 public function init()
 {
     $db = new PHPWS_DB('branch_sites');
     $result = $db->loadObject($this);
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         return $result;
     }
 }
Example #11
0
 public function load()
 {
     $db = new PHPWS_DB('hms_banner_queue');
     $db->addWhere('id', $this->id);
     $result = $db->loadObject($this);
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
 }
Example #12
0
 public function __construct($id = 0)
 {
     if (!$id) {
         return;
     }
     $this->id = (int) $id;
     $db = new \PHPWS_DB('prop_messages');
     $db->loadObject($this);
 }
Example #13
0
 public function __construct($id = null)
 {
     if (!$id) {
         return;
     }
     $db = new \PHPWS_DB('prop_contacts');
     $db->addWhere('id', (int) $id);
     $db->loadObject($this);
 }
Example #14
0
 function InterWiki($id = NULL)
 {
     if (empty($id)) {
         return;
     }
     $this->setId($id);
     $db = new PHPWS_DB('wiki_interwiki');
     $db->loadObject($this);
 }
Example #15
0
 /**
  * Loads this term object, if we have an id.
  */
 public function init()
 {
     $db = new PHPWS_DB('hms_term');
     $db->addWhere('term', $this->term);
     $result = $db->loadObject($this);
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
 }
Example #16
0
 public function init()
 {
     $db = new PHPWS_DB('rss_channel');
     $result = $db->loadObject($this);
     if (PHPWS_Error::isError($result)) {
         $this->_error = $result;
         return $result;
     }
 }
Example #17
0
 public function init()
 {
     $db = new PHPWS_DB('signup_slots');
     $result = $db->loadObject($this);
     if (PHPWS_Error::logIfError($result) || !$result) {
         $this->id = 0;
         return false;
     }
     return true;
 }
Example #18
0
 public function init()
 {
     $db = new PHPWS_DB('signup_peeps');
     $result = $db->loadObject($this);
     if (PHPWS_Error::isError($result)) {
         $this->_error = $result;
     } elseif (!$result) {
         $this->id = 0;
     }
 }
Example #19
0
 public function init()
 {
     $db = new PHPWS_DB('search');
     $db->addWhere('key_id', $this->key_id);
     $result = $db->loadObject($this);
     if (PHPWS_Error::isError($result)) {
         $this->_error = $result;
     }
     $this->loadKeywords();
 }
Example #20
0
 public function __construct($id = 0)
 {
     if (!$id) {
         return;
     }
     $this->id = (int) $id;
     $db = new PHPWS_DB('checkin_visitor');
     if (!$db->loadObject($this)) {
         $this->id = 0;
     }
 }
Example #21
0
 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;
 }
Example #22
0
 public function HMS_Movein_Time($id = NULL)
 {
     if (!isset($id) || is_null($id)) {
         return;
     }
     $db = new PHPWS_DB('hms_movein_time');
     $db->addWhere('id', $id);
     $result = $db->loadObject($this);
     if (!$result || PHPWS_Error::logIfError($result)) {
         $this->id = 0;
     }
 }
Example #23
0
 public function load()
 {
     if (is_null($this->id) || !is_numeric($this->id)) {
         return false;
     }
     $db = new PHPWS_DB('hms_special_assignment');
     $db->addWhere('id', $this->id);
     $result = $db->loadObject($this);
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->getMessage());
     }
     return true;
 }
 /**
  * Loads an object from the database using the given class name and object id.
  *
  * @param String $class
  * @param int $id
  */
 public static function load($class, $id)
 {
     \PHPWS_Core::initModClass($class . '.php');
     $table = $class::getTableName();
     $db = new \PHPWS_DB($table);
     $instance = new $class();
     $db->addWhere('id', $id);
     $result = $db->loadObject($instance);
     if (\PHPWS_Error::logIfError($result)) {
         throw new \Exception($result->toString());
     }
     return $result;
 }
Example #25
0
 public function init()
 {
     if (!$this->id) {
         return false;
     }
     $db = new PHPWS_DB('blog_entries');
     $result = $db->loadObject($this);
     if (PHPWS_Error::isError($result)) {
         return $result;
     } elseif (!$result) {
         $this->id = 0;
     }
 }
Example #26
0
 public function init()
 {
     $db = new PHPWS_DB('menu_links');
     $result = $db->loadObject($this);
     if (PHPWS_Error::isError($result)) {
         return $result;
     }
     if (!$result) {
         $this->id = 0;
         return false;
     }
     $this->loadChildren();
 }
Example #27
0
 /**
  * Diff
  *
  * Main function: Calls the diff and render, then outputs to layout
  *
  * @author Greg Meiste <*****@*****.**>
  */
 function diff($oVer, $nVer)
 {
     PHPWS_Core::initModClass('wiki', 'OldWikiPage.php');
     $olderpage = new OldWikiPage();
     $newerpage = new OldWikiPage();
     $db = new PHPWS_DB('wiki_pages_version');
     $db->addWhere('title', $_REQUEST['page']);
     $db->addWhere('vr_number', $oVer);
     $db->loadObject($olderpage);
     $db->reset();
     $db->addWhere('title', $_REQUEST['page']);
     $db->addWhere('vr_number', $nVer);
     $db->loadObject($newerpage);
     // Need to parse the text, but we can't call parseOutput or this module's
     // transform function.  They both do too much parsing and can't be used
     // for a diff.  So, we call what is needed directly:
     $oPagetext = htmlspecialchars(str_replace("&#39;", "'", $olderpage->getPagetext(FALSE)));
     $nPagetext = htmlspecialchars(str_replace("&#39;", "'", $newerpage->getPagetext(FALSE)));
     if (!ALLOW_PROFANITY) {
         $oPagetext = PHPWS_Text::profanityFilter($oPagetext);
         $nPagetext = PHPWS_Text::profanityFilter($nPagetext);
     }
     // End diff text parsing
     $oPagetext = explode("\n", $oPagetext);
     $nPageText = explode("\n", $nPagetext);
     $diff = new Text_Diff($oPagetext, $nPageText);
     $this->render($diff);
     $tags = array();
     $tags['TITLE'] = dgettext('wiki', 'Difference between revisions');
     $tags['BACK_PAGE'] = PHPWS_Text::moduleLink(dgettext('wiki', 'Back to Page'), 'wiki', array('page' => $_REQUEST['page']));
     $tags['BACK_HISTORY'] = PHPWS_Text::moduleLink(dgettext('wiki', 'Back to History'), 'wiki', array('page_op' => 'history', 'page_id' => $newerpage->getSourceId()));
     $tags['DIFF'] = $this->_output;
     $tags['OLDER_VERSION'] = $olderpage->getVrNumber();
     $tags['NEWER_VERSION'] = $newerpage->getVrNumber();
     $tags['OLDER_UPDATED'] = $olderpage->getUpdated();
     $tags['NEWER_UPDATED'] = $newerpage->getUpdated();
     $tags['VERSION_LABEL'] = dgettext('wiki', 'Version');
     return PHPWS_Template::process($tags, 'wiki', 'diff/' . $this->_format . '/diff.tpl');
 }
 /**
  * Returns the EmergencyContact object with the given id from the database.
  *
  * @param int $id
  * @return EmergencyContact
  * @throws InvalidArgumentException
  * @throws Exception
  * @see EmergencyContactDB
  */
 public static function getContactById($id)
 {
     if (is_null($id) || !isset($id)) {
         throw new \InvalidArgumentException('Missing contact id.');
     }
     $db = new \PHPWS_DB('intern_emergency_contact');
     $db->addWHere('id', $id);
     $contact = new EmergencyContactDB();
     $result = $db->loadObject($contact);
     if (\PHPWS_Error::logIfError($result)) {
         throw new \Exception($result->toString());
     }
     return $contact;
 }
Example #29
0
 public function init()
 {
     $db = new PHPWS_DB('ps_block');
     $result = $db->loadObject($this);
     if (PHPWS_Error::logIfError($result)) {
         return $result;
     }
     if (!$result) {
         $this->id = 0;
         return false;
     } else {
         return true;
     }
 }
Example #30
0
 /**
  * Loads a HMS_Learning_Community object from the database given its id.
  *
  * @param int $id
  * @return HMS_Learning_Community The requested learning community object.
  */
 public static function getRlcById($id)
 {
     if (is_null($id) || !is_numeric($id)) {
         throw new InvalidArgumentException('Missing RLC id.');
     }
     $db = new PHPWS_DB('hms_learning_communities');
     $db->addWhere('id', $id);
     $community = new RestoredRlc();
     $result = $db->loadObject($community);
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->toString());
     }
     return $community;
 }