PHP User::Model Examples

PHP User::Model - 6 examples found. These are the top rated real world PHP examples of User::Model extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
 public function actionSendMail()
 {
     date_default_timezone_set('UTC');
     $startdate = date('Y-m-d H:i:s', strtotime('+1 hours'));
     $enddate = date('Y-m-d H:i:s', strtotime('+2 hours 1 minute'));
     $Poses = Pos::model()->findAll(array('select' => '*', 'condition' => 'date > "' . $startdate . '" and date < "' . $enddate . '"'));
     $users = User::Model()->findAll(array('select' => '*'));
     $subject = 'POS Timer Alert';
     foreach ($Poses as $pos) {
         $message = 'The ' . $pos->type . ' in ' . $pos->location . ' is due out of reinforced at ' . $pos->date . PHP_EOL;
         foreach ($users as $user) {
             $profiles = Profile::model()->findByPk($user->id);
             if ($profiles->subscribe) {
                 $email = $user->email;
                 echo $email . '  ' . $subject . '  ' . $message;
                 UserModule::sendMail($email, $subject, $message);
             }
         }
     }
 }
Example #2
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Lead();
     $result = new User();
     $res = User::Model()->findallByattributes(array('superuser' => 2));
     $leaduser = new LeadUsers();
     $prop = Priority::Model()->findall();
     $rem = Reminders::Model()->findall();
     if (isset($_POST['Lead'])) {
         /* $model->reminder_time=$_POST['Lead']['reminder_time'].':'.$_POST['Lead']['sec']; */
         $model->status = 1;
         $model->min_size = $_POST['Lead']['min_size'];
         $model->max_size = $_POST['Lead']['max_size'];
         $model->retailer_webiste = $_POST['Lead']['retailer_webiste'];
         $model->broker_firstname = $_POST['Lead']['broker_firstname'];
         $model->broker_lastname = $_POST['Lead']['broker_lastname'];
         $model->broker_territory = $_POST['Lead']['broker_territory'];
         $model->broker_company = $_POST['Lead']['broker_company'];
         /* 		$model->broker_phone_no= $_POST['broker_phone_no'];
         			$model->broker_cell_no= $_POST['broker_cell_no'];
         			$model->broker_email= $_POST['broker_email'];  */
         $model->linked_username = $_POST['Lead']['linked_username'];
         $model->enquiry_date = $_POST['enquiry_date'];
         $model->create_at = date('Y-m-d-h:i:sa');
         $model->country = $_POST['country'];
         /* 	$model->reminder_date=$_POST['reminder_date']; */
         $model->user_id = Yii::app()->user->id;
         $model->attributes = $_POST['Lead'];
         /* 	echo "<pre>"; print_r(array($model->attributes,$_POST));  */
         if ($model->save()) {
             /* if(isset($_POST['reminder_date'])){
             			$Last_id = $model->id; 
             			$status = 1;
             			Yii::app()->db->createCommand("INSERT INTO `tbl_reminders`(`lead_id`,`date`,`time`,`msg`,`status` ) VALUES ('".$Last_id."', '".$_POST['reminder_date']."','".$_POST['Lead']['reminder_time'].":".$_POST['Lead']['sec']."','".$_POST['Lead']['message']."','".$status."')"  )->execute(); } */
             $this->redirect(array('admin'));
         }
     }
     $this->render('create', array('model' => $model, 'models' => $res, 'props' => $prop));
 }
Example #3
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $cur_user = Yii::app()->user->id;
     $user = User::Model()->findAllByAttributes(array('id' => $cur_user));
     if ($user[0]['superuser'] == 1) {
         $model = new Source('search');
         $model->unsetAttributes();
         // clear any default values
         if (isset($_GET['Source'])) {
             $model->attributes = $_GET['Source'];
         }
         $this->render('admin', array('model' => $model));
     } else {
         echo "!Error 504 Page Not Found";
     }
 }
Example #4
0
 /** @public-query-method */
 public static function findLoginUser($userNameFieldValue)
 {
     $user = User::Model()->find('user_name=:user_name', array(':user_name' => $userNameFieldValue));
     return $user;
 }
Example #5
0
:</b>
	<?php 
echo CHtml::encode($data->expirationTime);
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('priority'));
?>
:</b>
	<?php 
if ($data->priority == 1) {
    echo "High";
} else {
    echo "Low";
}
?>
	<br />

	<b><?php 
echo CHtml::encode($data->getAttributeLabel('userId'));
?>
:</b>
	<?php 
echo CHtml::encode(User::Model()->FindByPk($data->userId)->username);
?>
 
	<br />


</div>
 public function actionGetTotal($ridString)
 {
     $uid = Yii::app()->user->id;
     $curUser = User::Model()->findByPk($uid);
     $userType = $curUser->type;
     $ridStrArray = explode(".", $ridString);
     $count = count($ridStrArray);
     $ridArray = array();
     $resArray = array();
     $productArray = array();
     $total = 0;
     $newTotal = 0;
     for ($i = 0; $i < $count; $i++) {
         $ridArray[] = (int) $ridStrArray[$i];
         $resArray[] = Res::Model()->findByPk($ridArray[$i]);
         $productArray[] = Product::Model()->findByPk($resArray[$i]->pid);
         $total = $total + $productArray[$i]->price * $resArray[$i]->amount;
     }
     switch ($userType) {
         case 1:
             $newTotal = $total * 0.9;
             break;
         case 2:
             $newTotal = $total * 0.85;
             break;
         case 3:
             $newTotal = $total * 0.75;
             break;
         default:
             $newTotal = $total;
             break;
     }
     $totalArray = array("total" => $newTotal, "type" => $userType, "former" => $total);
     echo json_encode($totalArray);
 }