Exemple #1
0
 public static function get_db_name($source)
 {
     $dbObj = new dbAPI();
     if ($source == 'content' || $source == "CMSdb") {
         return $dbObj->db_get_contentDB();
     } else {
         return $dbObj->db_get_usersDB();
     }
 }
Exemple #2
0
 public static function get_locking_user($UID, $entity_type)
 {
     $dbObj = new dbAPI();
     $query = "SELECT usr.* FROM " . dbAPI::get_db_name('content') . ".CONTENT_LOCK AS lk INNER JOIN " . dbAPI::get_db_name('user') . ".USERS AS usr ON (usr.UID = lk.USER_ID) where lk.LOCKED_UID = '" . $UID . "' AND lk.ENTITY_TYPE = '" . $entity_type . "' AND lk.LOCK_STATUS = 'LOCKED' AND lk.ENABLED = 1 ";
     $results = $dbObj->db_select_query($dbObj->db_get_contentDB(), $query);
     if (count($results) > 0) {
         $usr = $results[0];
         $usr["PASSWORD"] = '******';
         return $usr;
     }
     return null;
 }
Exemple #3
0
 public static function get_terms_of_scope($scope_UID, $lang = '')
 {
     $terms = array();
     // extract scope terms relations
     $dbObj = new dbAPI();
     $query = "SELECT * FROM TERMS where ENABLED = 1 AND ( ID_SCOPE = " . $scope_UID . ")";
     $terms_related = $dbObj->db_select_query($dbObj->db_get_contentDB(), $query);
     if ($terms_related == null) {
         return null;
     }
     // get terms details
     for ($i = 0; $i < count($terms_related); $i++) {
         $curr_term = term::get_term_by_UID_with_relations($terms_related[$i]["ID_TERM_STRING"], $lang);
         if ($curr_term != null) {
             array_push($terms, $curr_term);
         }
     }
     return $terms;
 }
Exemple #4
0
 /**
  * Returns the Delivery's base from content database
  * @param  {int} $UID The UID of the requested Delivery
  * @return {DeliveryBase}      the requested Delivery
  */
 public static function get_Delivery_by_UID($UID)
 {
     // returns the Delivery from content database for as read-only
     $dbObj = new dbAPI();
     $query = "SELECT * FROM DELIVERY_BASE where UID = '" . $UID . "' AND ENABLED = '1'";
     $results = $dbObj->db_select_query($dbObj->db_get_contentDB(), $query);
     if (count($results) == 0) {
         return null;
     }
     return $results[0];
 }
Exemple #5
0
 public static function get_scopes_of_term($term_UID, $lang = '')
 {
     $scopes = array();
     // extract scope terms relations
     $dbObj = new dbAPI();
     $query = "SELECT * FROM TERMS where ENABLED = 1 AND ( ID_TERM_STRING = " . $term_UID . ")";
     $scopes_related = $dbObj->db_select_query($dbObj->db_get_contentDB(), $query);
     if ($scopes_related == null) {
         return null;
     }
     // get scopes and meanings details
     for ($i = 0; $i < count($scopes_related); $i++) {
         $curr_scope = scope::get_scope_by_UID($scopes_related[$i]["ID_SCOPE"], $lang);
         $curr_meaning = term::get_term_meaning_by_UID($scopes_related[$i]["ID_TERM_MEAN"], $lang);
         if ($curr_scope != null) {
             array_push($scopes, array('scope' => $curr_scope, 'meaning' => $curr_meaning));
         }
     }
     return $scopes;
 }