Пример #1
0
 /**
  * TuiyoModelTimeline::deleteActivity()
  * Deletes an activity from the user timeline
  * @param mixed $userID
  * @param mixed $activityID
  * @param mixed $options
  * @return void
  */
 public function deleteActivity($userID, $activityID, $options)
 {
     $table = TuiyoLoader::table("timeline");
     $tTable = TuiyoLoader::table("timelinetmpl");
     $table->load((int) $activityID);
     if (empty($table->ID) || $table->userID != $userID) {
         JError::raiseError(TUIYO_SERVER_ERROR, _("Could not load the activity"));
     }
     if (!empty($table->template) && (int) $table->template > 0) {
         //print_R($tTable);
         $ltTable = new TuiyoTableTimelinetmpl($this->_db);
         $ltTable->load((int) $table->template);
         if (!$ltTable->delete()) {
             JError::raiseError(TUIYO_SERVER_ERROR, $table->getError());
             return false;
         }
     }
     if (!$table->delete()) {
         JError::raiseError(TUIYO_SERVER_ERROR, $table->getError());
         return false;
     }
     return true;
 }