예제 #1
0
 public function actionGetgambar($idp)
 {
     $user = Yii::app()->user->id;
     if (Yii::app()->user->level() == '3') {
         $id_member = Member::model()->find("TRIM(email) = '{$user}'")->id;
     } else {
         $id_member = MemberSub::model()->find("TRIM(email) = '{$user}'")->id_member;
     }
     /*
     $sql = "SELECT 
     p.id idp,
     pv.view_name name_view, 
     pv.id idviews ,
     project_name,
     phase,
     ph.datetime, ph.project_id, 
     pdm.name_file,pdm.id AS id_comment,
     SUBSTRING_INDEX(pdm.name_file,'.',-1) AS ext,
     pdm.description description,
     pdm.confirmer confirmer
     
     FROM
     project AS p 
     INNER JOIN 
     project_views AS pv
     ON p.id = pv.project_id
     INNER JOIN
     project_comment_head AS ph 
     ON pv.id = ph.project_views_id
     INNER JOIN
     
     (
     SELECT 
     MAX(id) id ,
     MAX(head_project_id) head_project_id,
     MAX(name_file) name_file,
     MAX(comment_id) comment_id,
     STATUS,
     MAX(alias_name) alias_name,
     MAX(confirmer) confirmer,
     MAX(confirmed_date) confirmed_date,
     MAX(description) description,
     MAX(project_views_id) project_views_id
     
     FROM project_comment pc
     where status = 1
     GROUP BY 
     pc.project_views_id
     )
      AS pdm
     ON pdm.head_project_id = ph.id
     WHERE 
     p.id_member = '$id_member'
     AND
     pdm.status = 1 
     AND
     SUBSTRING_INDEX(pdm.name_file,'.',-1) IN ('jpg','png','gif','PNG','JPG','GIF')
     
     and pv.id = '$id'
      
     GROUP BY pdm.project_views_id
     ORDER BY pv.created_date DESC";
     // echo $sql;
     $model = Yii::app()->db->createCommand($sql)->queryRow();
     */
     // $sql = "select * from project_views where project_id = '$idp' ";
     // $sql = "SELECT pv.id idviews ,ph.datetime, ph.project_id,
     $sql = "\n\t\tselect\n\t\tpdm.name_file,pdm.id as id_comment,\n\t\tSUBSTRING_INDEX(pdm.name_file,'.',-1) AS ext\n\t\tFROM\n\t\tproject AS p \n\t\tINNER JOIN \n\t\tproject_views AS pv\n\t\tON p.id = pv.project_id\n\t\tINNER JOIN\n\t\tproject_comment_head AS ph \n\t\tON pv.id = ph.project_views_id\n\t\tINNER JOIN\n\n\t\t(select * from project_comment order by id desc)\n\t\t AS pdm\n\t\tON pdm.head_project_id = ph.id\n\t\twhere \n\t\tp.id_member = '{$id_member}'\n\t\tand\n\t\tpdm.status = 1 \n\t\tand\n\t\tSUBSTRING_INDEX(pdm.name_file,'.',-1) in ('jpg','png','gif','PNG','JPG','GIF')\n\t\tand \n\t\tp.id = '{$idp}'\n\t\tGROUP BY pv.id\n\t\tORDER BY pv.created_date DESC\n\n\t\t";
     // echo $sql;
     $model = Yii::app()->db->createCommand($sql)->queryAll();
     // echo $sql;
     $this->renderPartial("application.views.client.get.getgambar", array('model' => $model));
     // print_r($model);
     // $array = array();
     // $array["name_file"] = $model["name_file"];
     // $array["id_comment"] = $model["id_comment"];
     // $array["name_view"] = $model["name_view"];
     // $array["description"] = $model["description"];
     // $array["confirmer"] = $model["confirmer"];
     // $array["project_name"] = $model["project_name"];
     // $array["phase"] = $model["phase"];
     // $array["budget"] = 0;
     // $array["number_views"] = $model["number_views"];
     // $array["status"] = Status::model()->findByPk($model["status"])->name;
     // $array["team"] = $model["worker"];
     // echo json_encode($array);
 }
예제 #2
0
						</div>
				</div>
		</div>
</div>
		
		<div  id="wrapper-dashboard-first" >
			<div id="sp" style="height:310px;" >
				<div class="filter-proses">					
					CURRENT PROJECTS
				</div>
				<?php 
$id = Yii::app()->user->id;
if (Yii::app()->user->level() == '3') {
    $id_member = Member::model()->find("TRIM(email) = '{$id}'")->id;
} else {
    $id_member = MemberSub::model()->find("TRIM(email) = '{$id}'")->id_member;
}
$redbox = Yii::app()->db->createCommand()->select("*")->from('project')->where("STATUS =1 and id_member = '{$id_member}' ")->limit('4')->queryAll();
?>
				<table class="dashboard-project" 
				style="
					" 
				>

					<thead style="margin-bottom:15px;">						
						<tr>
							<th style="text-align:left;font-size:15px;padding-bottom:15px;">NAME</th>
							<th style="padding-bottom: 15px;font-size:15px;">DUE DATE</tdh>
							<th style="font-size:15px;padding-bottom: 15px;">UPCOMING</th>
						</tr>
					</thead>
예제 #3
0
?>
/img/big-loader.gif" alt="" class="loader">
	<h2>List your Employee </h2>
	<table >
		<tr>
			<th>no</th>
			<th>name</th>
			<th>join date</th>
			<th>email</th>
			<th>email invitation</th>
			<th>status</th>
			<th>Action</th>
		</tr>
		<?php 
$no = 1;
foreach (MemberSub::model()->findAll("id_member = '{$id_member}'") as $ms) {
    ?>
			<!-- # code... -->
		<tr>
			<td ><?php 
    echo $no;
    ?>
</td>
			<td><?php 
    echo $ms->name;
    ?>
</td>
			<td><?php 
    echo $ms->date_invite;
    ?>
</td>
예제 #4
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = MemberSub::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #5
0
 public function actionSendinvite()
 {
     $email = $_REQUEST['email'];
     $name = Yii::app()->user->name;
     if (isset($_REQUEST['email'])) {
         $sub = new MemberSub();
         $sub->name = "uknown";
         $sub->email = $email;
         $sub->id_member = Member::model()->find("email = '{$name}' ")->id;
         $sub->date_invite = date('Y-m-d h:i:s');
         $sub->status = 0;
         $sub->status_email = 0;
         if ($sub->save()) {
             Yii::import('ext.yii-mail.YiiMailMessage');
             $message = new YiiMailMessage();
             $message->view = "invite";
             $params = array('email' => $email, 'name' => $name);
             $message->setBody($params, 'text/html');
             $message->subject = "invitation for join vvfy";
             $message->addTo($email);
             $message->from = Yii::app()->params['adminEmail'];
             if (Yii::app()->mail->send($message)) {
                 $sub->status_email = 1;
                 if ($sub->update()) {
                     echo "succes";
                 }
             } else {
                 echo "email invitation has not been sent";
             }
         } else {
             // print_r($sub->getErrors());
             echo CHtml::errorSummary($sub);
             // echo $sub->email;
         }
     } else {
         echo "requset not found";
     }
 }