示例#1
0
 /**
  * TuiyoTableTimelinetmpl::getInstance()
  * 
  * @param mixed $db
  * @param bool $ifNotExist
  * @return
  */
 public function getInstance($db = null, $ifNotExist = true)
 {
     /** Creates new instance if none already exists ***/
     static $instance = array();
     if (isset($instance) && !empty($instance) && $ifNotExist) {
         if (is_object($instance)) {
             return $instance;
         } else {
             unset($instance);
             TuiyoTableTimelinetmpl::getInstance($db, $ifNotExist);
         }
     } else {
         $instance = new TuiyoTableTimelinetmpl($db);
     }
     return $instance;
 }
示例#2
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;
 }
示例#3
0
 /**
  * 
  * TuiyoTableResources::lastUploadNotRecent()
  * Checks if the last photoupload activity is within the 5 min treshold
  * 
  * @param mixed $userID
  * @return void
  */
 public function canCreateNewActivity($userID)
 {
     $tTable =& TuiyoLoader::table("timelinetmpl", TRUE);
     $dbo = $this->_db;
     $query = "SELECT template, datetime FROM #__tuiyo_timeline " . "\nWHERE userID=" . $dbo->quote((int) $userID) . "\nAND source = 'photos'" . "\nORDER BY datetime DESC LIMIT 1";
     $dbo->setQuery($query);
     $row = $dbo->loadObjectList();
     if (sizeof($row) < 1) {
         return false;
     }
     $now = time();
     $time = strtotime($row[0]->datetime);
     if ($now < $time + 3600) {
         //print_R($tTable);
         $ltTable = new TuiyoTableTimelinetmpl($this->_db);
         $ltTable->load((int) $row[0]->template);
         return $ltTable;
     }
 }