public function deletepicture($post)
 {
     $pic_id = $post['pic_id'];
     if ($pic_id != 0) {
         Projectphotos::model()->deleteByPk($pic_id);
         $status = array('success' => true);
         $this->renderJSON($status);
     }
 }
 public function actionJobdetails()
 {
     if (!Yii::app()->user->isGuest) {
         $this->pageTitle = 'Handyman.com - Job Details';
         $project_id = Yii::app()->Ini->v('pj_id');
         //$criteria=new CDbCriteria();
         //$criteria->condition = "project_id = '$project_id'";
         $criteria = new CDbCriteria();
         $criteria->condition = "project_id = '{$project_id}'";
         $details = Projects::model()->findByAttributes(array('project_id' => $project_id));
         if (count($details) > 0) {
             $projectphotos = Projectphotos::model()->findAll($criteria);
             $main_photo = Projectphotos::model()->findByAttributes(array('project_id' => $project_id, 'is_main' => '1'));
             //$projectphotos = Projectphotos::model()->findByAttributes(array('project_id'=>$project_id));
             if ($main_photo) {
                 $main_photo = Yii::app()->request->baseUrl . '/uploads/projectphotos/' . $main_photo->filename;
             } else {
                 $main_photo = "http://www.justmail.in/platinum/images/work_noimage.jpg";
             }
             $this->render('project_details', array('project_id' => $details->project_id, 'homeowner_id' => $details->homeowner_id, 'project_type_name' => $this->getProjectTypeName($details->project_type_id), 'description' => $details->description, 'owner_name' => $this->getOwnerName($details->homeowner_id), 'start_date' => $details->start_date, 'status_for_project' => $details->status_for_project, 'time_frame' => $details->time_frame, 'owned_property' => $details->owned_property, 'date_added' => $details->date_added, 'state2' => $this->getStateByName($details->state_id), 'status_for_project' => $details->status_for_project, 'city' => $details->city, 'zipcode' => $details->zipcode, 'projectphotos' => $projectphotos, 'username' => $this->getOwnerUname($details->homeowner_id), 'main_photo' => $main_photo));
         } else {
             $this->redirect(Yii::app()->homeUrl . 'home/error');
         }
     } else {
         $this->redirect(Yii::app()->homeUrl);
     }
 }
Beispiel #3
0
 public function deactivate($homeowner_id)
 {
     $criteria = new CDbCriteria();
     $criteria->condition = "user_type='homeowner' AND userid=" . $homeowner_id;
     Affiliates::model()->deleteAll($criteria);
     Referral::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "owner_user_type='homeowner' AND owner_id=" . $homeowner_id;
     Answers::model()->deleteAll($criteria);
     Questions::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "user_type='homeowner' AND deleted_by=" . $homeowner_id;
     Messagedeleted::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "from_user_type='homeowner' AND from_id=" . $homeowner_id;
     Messages::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "to_user_type='homeowner' AND to_id=" . $homeowner_id;
     Messages::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "project_id NOT IN (Select project_id from projects where homeowner_id = {$homeowner_id} )";
     Projectphotos::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "viewed_user_type='homeowner' AND viewed_by=" . $homeowner_id;
     QuestionViews::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "referred_by_type='homeowner' AND referred_by=" . $homeowner_id;
     Referral::model()->deleteAll($criteria);
     $criteria = new CDbCriteria();
     $criteria->condition = "homeowner_id=" . $homeowner_id;
     HomeownerPoints::model()->deleteAll($criteria);
     Feedback::model()->deleteAll($criteria);
     HomeownerViews::model()->deleteAll($criteria);
     Projects::model()->deleteAll($criteria);
     self::model()->deleteAll($criteria);
     return true;
 }