示例#1
0
 public static function add_relation_to_scope($parent_scope_UID, $child_scope_UID, $is_hier, $user)
 {
     // create relation between two terms
     if (refRelation::add_relation_to_object($parent_scope_UID, $child_scope_UID, $is_hier, $user, 'R_Ls2s') == null) {
         debugLog::log("parent scope (" . $parent_scope_UID . ") and child (" . $child_scope_UID . ") scope cannot be the same");
         return null;
     }
     // return recently created relation
     return refRelation::get_objects_relation($parent_scope_UID, $child_scope_UID, 'R_Ls2s');
 }
示例#2
0
 public static function remove_D2D_relation($first_UID, $second_UID)
 {
     // check if delivery is locked by user
     if (Lock::is_locked_by_user($first_UID, 'DELIVERY_BASE', $user) == false && Lock::is_locked_by_user($second_UID, 'DELIVERY_BASE', $user) == false) {
         debugLog::log("<i>[delivery.php:add_D2D_relation]</i> Non of the deliveries (" . $first_UID . ", " . $second_UID . ") are locked by user (" . $user . ")");
         return null;
     }
     // check soft lock
     $locking_user = Lock::get_locking_user($first_UID, 'DELIVERY_BASE');
     if ($locking_user != null && $locking_user["UID"] != $user) {
         debugLog::log("<i>[delivery.php:add_D2D_relation]</i> one of the deliveries (" . $first_UID . ") is locked by other user(" . $locking_user["UID"] . ")");
         return null;
     }
     $locking_user = Lock::get_locking_user($second_UID, 'DELIVERY_BASE');
     if ($locking_user != null && $locking_user["UID"] != $user) {
         debugLog::log("<i>[delivery.php:add_D2D_relation]</i> one of the deliveries (" . $first_UID . ") is locked by other user(" . $locking_user["UID"] . ")");
         return null;
     }
     if (refRelation::add_relation_to_object($first_UID, $second_UID, $is_hier, $user, 'R_LD2D', 'user') == null) {
         debugLog::log("<i>[delivery.php:add_D2D_relation]</i> parent Delivery (" . $first_UID . ") and child (" . $second_UID . ") Delivery cannot be the same");
         return null;
     }
     refRelation::remove_relation($first_UID, $second_UID, 'R_LD2D', 'user');
 }
示例#3
0
 public static function add_K2K_relation($first_UID, $second_UID, $is_hier, $user)
 {
     // check if Kbits is locked by user
     if (Lock::is_locked_by_user($first_UID, 'KBIT_BASE', $user) == false && Lock::is_locked_by_user($second_UID, 'KBIT_BASE', $user) == false) {
         debugLog::log("<i>[Kbits.php:add_K2K_relation]</i> Non of the Kbits (" . $first_UID . ", " . $second_UID . ") are locked by user (" . $user . ")");
         return null;
     }
     // check soft lock
     $locking_user = Lock::get_locking_user($first_UID, 'KBIT_BASE');
     if ($locking_user != null && $locking_user["UID"] != $user) {
         debugLog::log("<i>[Kbits.php:add_K2K_relation]</i> one of the Kbits (" . $first_UID . ") is locked by other user(" . $locking_user["UID"] . ")");
         return null;
     }
     $locking_user = Lock::get_locking_user($second_UID, 'KBIT_BASE');
     if ($locking_user != null && $locking_user["UID"] != $user) {
         debugLog::log("<i>[Kbits.php:add_K2K_relation]</i> one of the Kbits (" . $first_UID . ") is locked by other user(" . $locking_user["UID"] . ")");
         return null;
     }
     if (refRelation::add_relation_to_object($first_UID, $second_UID, $is_hier, $user, 'R_LK2K', 'user') == null) {
         debugLog::log("<i>[Kbits.php:add_K2K_relation]</i> parent Kbit (" . $first_UID . ") and child (" . $second_UID . ") Kbit cannot be the same");
         return null;
     }
     // return recently created relation
     return refRelation::get_objects_relation($first_UID, $second_UID, 'R_LK2K', 'user');
 }