コード例 #1
0
 public function addUpdateEndorsement($skill_endorsement_id, $skill_id, $display_user_id, $logged_user_id, $message)
 {
     $dbc = mysqli_connect($GLOBALS['db_servername'], $GLOBALS['db_username'], $GLOBALS['db_password'], $GLOBALS['db_name']) or die("Not connected..");
     if ($skill_endorsement_id <= 0) {
         $q = "INSERT INTO skill_endorsements (user_id, skill_id, endorsed_by_user_id, comments)\nVALUES (" . $display_user_id . "," . $skill_id . "," . $logged_user_id . ",'" . $message . "')";
     } else {
         $q = "Update skill_endorsements \n\t\t\t\t\tset \n\t\t\t\t\t\tcomments='" . $message . "',\n\t\t\t\t\t\tendorsed_on=CURRENT_TIMESTAMP\n\t\t\t\t\twhere skill_endorsement_id=" . $skill_endorsement_id;
     }
     //echo $q . '<br>';
     $r = mysqli_query($dbc, $q);
     // Get $skill_endorsement_id of the insert query
     if ($skill_endorsement_id <= 0) {
         $skill_endorsement_id = -1;
         if ($r) {
             $skill_endorsement_id = mysqli_insert_id($dbc);
         }
     }
     mysqli_close($dbc);
     // close the connection
     if ($r) {
         // Add notification -- endorsed
         $objNotification = new notification();
         $result = $objNotification->addNotification(3, $display_user_id, $logged_user_id, $skill_endorsement_id);
         return true;
     } else {
         return false;
     }
 }
コード例 #2
0
 public function addProject($user_id, $project_name, $project_desc, $start_date, $end_date, $manager_user_id, $skills)
 {
     $project_id = $this->insertProject($user_id, $project_name, $project_desc, $start_date, $end_date, $manager_user_id);
     if ($project_id > 0) {
         // Successfuly inserted project, now insert skills
         $result = $this->insertProjectSkills($project_id, $skills);
     } else {
         $result = false;
     }
     if ($result == true) {
         // Add notification -- project added
         $objNotification = new notification();
         $result = $objNotification->addNotification(1, $manager_user_id, $user_id, $project_id);
     }
     return $result;
 }