Ejemplo n.º 1
0
 /**
  * Adds new instance of Kbit's front to the specific front table based on FRONT_TYPE in edit mode(to users database)
  * @param {int} $UID The UID of the base Kbit
  * @param {frontKbit} $front array of key value pair in FRONT format
  * @param {int} $user User id of the creator
  * @return {frontKbit}
  */
 private static function add_new_front($UID, $front, $user)
 {
     $dbObj = new dbAPI();
     $front_type = $front["FRONT_TYPE"];
     if ($front_type == null) {
         debugLog::log("<i>[Kbits.php:add_new_front]</i> FRONT Kbit type of (" . $UID . ") is missing!");
         return null;
     }
     // determine which front kbit insertion function should be called
     switch ($front_type) {
         case "KBIT_FRONT":
             $kbit_front = Kbit::add_new_KBIT_FRONT($UID, $front, $user);
             if ($kbit_front == null) {
                 debugLog::log("<i>[Kbits.php:add_new_front]</i> Could not insert a new front Kbit of the base (" . $UID . "), [add_new_KBIT_FRONT] faild");
                 return null;
             }
             return $kbit_front;
             break;
         case "YOUTUBE":
             // example for future formats
             debugLog::log("<i>[Kbits.php:add_new_front]</i> Dummy format was invoked (YOUTUBE)");
             return null;
         default:
             debugLog::log("<i>[Kbits.php:add_new_front]</i> Default case was invoked [UID]:(" . $UID . ")");
             return null;
     }
 }