Exemple #1
0
 public static function add_new_user($first_name, $last_name, $username, $password, $email, $profile_picture, $role)
 {
     if (!users::is_username_available($username)) {
         return false;
     }
     $dbObj = new dbAPI();
     $UID = $dbObj->get_latest_UID($dbObj->db_get_usersDB(), 'users');
     $UID++;
     $query = "INSERT INTO users (UID, FIRST_NAME, LAST_NAME, USERNAME, PASSWORD, EMAIL, PROFILE_PICTURE, ROLE, CREATION_DATE) VALUES (" . $UID . ", '" . $first_name . "', '" . $last_name . "', '" . $username . "', '" . $password . "', '" . $email . "', '" . $profile_picture . "', " . $role . ",'" . date("Y-m-d H:i:s") . "')";
     $dbObj->run_query($dbObj->db_get_usersDB(), $query);
     return true;
 }
Exemple #2
0
 public static function add_new_scope($title, $description, $user)
 {
     $dbObj = new dbAPI();
     // get new UID
     $UID = $dbObj->get_latest_UID($dbObj->db_get_contentDB(), 'scope');
     $UID++;
     // add record to database
     $query = "INSERT INTO scope (UID, TITLE, DESCRIPTION, ENABLED, USER_ID, CREATION_DATE) VALUES (" . $UID . ", '" . $title . "', '" . $description . "', 1, " . $user . ",'" . date("Y-m-d H:i:s") . "')";
     $dbObj->run_query($dbObj->db_get_contentDB(), $query);
     // returns an entity of recently added scope
     return scope::get_scope_by_UID($UID);
 }
Exemple #3
0
 /**
  * Add new Delivery in edit mode (users database)
  * @param {string} $title The title of the Delivery
  * @param {string} $desc  The description of the Delivery
  * @param {int} $user  The user's id who added the Delivery
  * @param {frontDelivery} $front array of key value pair in FRONT format
  * @return {Delivery}
  */
 public static function add_new_Delivery_in_edit_mode($title, $desc, $user, $front)
 {
     $dbObj = new dbAPI();
     // get new UID from contents database to reseve the UID
     $UID = $dbObj->get_latest_UID($dbObj->db_get_contentDB(), 'DELIVERY_BASE');
     $UID++;
     // try to acquire lock on the Delivery
     if (Lock::acquire_lock($UID, 'DELIVERY_BASE', $user) == false) {
         debugLog::log("<i>[delivery.php:add_new_Delivery_in_edit_mode]</i> Could not acquire lock on Delivery (" . $UID . "), check whether the Delivery is locked by other users");
         return null;
     }
     return Delivery::add_new_edit_for_Delivery($UID, $title, $desc, $user, $front);
 }
Exemple #4
0
 public static function add_meaning($meaning, $lang, $user)
 {
     $dbObj = new dbAPI();
     // get new UID
     $UID = $dbObj->get_latest_UID($dbObj->db_get_contentDB(), 'TERM_MEAN');
     $UID++;
     // add record to database
     $query = "INSERT INTO TERM_MEAN (UID, TEXT, LANG, ENABLED, USER_ID, CREATION_DATE) VALUES (" . $UID . ", '" . $meaning . "', '" . $lang . "', 1, " . $user . ",'" . date("Y-m-d H:i:s") . "')";
     $dbObj->run_query($dbObj->db_get_contentDB(), $query);
     // returns an entity of recently added term meaning
     return term::get_term_meaning_by_UID($UID, $lang);
 }