public function getmyheroesdata($userid, $share) { $criteria = new CDbCriteria(); $criteria->join = ' Join fn_user_finao t1 ON t.finao_id = t1.user_finao_id '; $criteria->join .= ' JOIN fn_users t2 ON t.updateby = t2.userid'; $criteria->join .= ' JOIN fn_lookups t3 ON t.notification_action = t3.lookup_id AND t3.lookup_type = "notificationaction"'; $criteria->join .= ' JOIN fn_lookups t4 ON t1.finao_status = t4.lookup_id AND t4.lookup_type = "finaostatus" '; $criteria->join .= ' JOIN fn_user_finao_tile t5 ON t1.user_finao_id = t5.finao_id '; $criteria->order .= 't.updateddate desc'; $criteria->group = ' t.tile_id, t.finao_id ,round(UNIX_TIMESTAMP(t.updateddate) / 600) desc'; $criteria->condition = ' t.tracker_userid = ' . $userid . ' and t1.finao_status_Ispublic = 1 and t1.finao_activestatus = 1'; $criteria->select = 't.*, t1.finao_msg, t4.lookup_name as finaostatus, t1.updateddate as finaoupdateddate, t2.fname, t2.lname, t3.lookup_name, t5.tile_id '; $trackingppl = Trackingnotifications::model()->findAll($criteria); $users = $this->getfollowersdetails($userid, -1, 0, 0); $ids = ""; foreach ($trackingppl as $tppl) { $ids .= $tppl->finao_id . ","; } $ids = substr($ids, 0, strlen($ids) - 1); $uploadinfo = ""; if ($ids != "") { $sourcetypeid = Lookups::model()->findByAttributes(array('lookup_type' => 'uploadsourcetype', 'lookup_status' => 1, 'lookup_name' => 'finao')); $uploadinfo = $this->getlatestuploaddetails($ids, $sourcetypeid->lookup_id); } return array('trackingppl' => $trackingppl, 'uploadinfo' => $uploadinfo, 'users' => $users); }
public function actionNotes() { $tracker_userid = Yii::app()->session['login']['id']; $tracked_userid = $_POST['userid']; $sourceid = $_POST['sourceid']; $source_type = $_POST['sourcetype']; $contentid = $_POST['contentid']; $note = Notess::model()->findByAttributes(array('upload_sourceid' => $sourceid, 'tracked_userid' => $tracked_userid, 'tracker_userid' => $tracker_userid, 'upload_sourcetype' => $source_type)); //$status = Notess::model()->findByAttributes(array('tracked_userid'=>$tracked_userid,'tracker_userid'=>$tracker_userid,'block_status'=>0)); if (!isset($note)) { $notes = new Notess(); $notes->upload_sourceid = $sourceid; $notes->tracked_userid = $tracked_userid; $notes->tracker_userid = $tracker_userid; $notes->upload_sourcetype = $source_type; $notes->contentnote_id = $contentid; if ($notes->save(false)) { $dates = date('Y-m-d G:i:s'); $notefication = new Trackingnotifications(); $notefication->tracker_userid = $tracked_userid; $notefication->tile_id = 0; $notefication->finao_id = $sourceid; $notefication->notification_action = 75; $notefication->createddate = $dates; $notefication->updateby = $tracker_userid; $notefication->createdby = $tracker_userid; if ($notefication->save(false)) { } /*$connection = yii::app()->db; $sql = "insert into fn_trackingnotifications set tracker_userid = '" .$tracked_userid. "',finao_id='" .$sourceid. "',notification_action='75', status='1',createddate='" . $dates . "', updatedby='" . $tracker_userid . "'"; $command = $connection->createCommand($sql)->execute(); */ } } /*if(isset($_POST['delete']) && $_POST['delete']!='') { $notes->upload_sourceid = $sourceid; $notes->tracked_userid = $tracked_userid; $notes->tracker_userid= $tracker_userid; $notes->upload_sourcetype= $source_type; if ($notes->delete()) {} }*/ }