Ejemplo n.º 1
0
 public function actionProfile()
 {
     $model = new Restaurants('profile');
     if (isset($_POST['Restaurants'])) {
         $_POST['Restaurants']['modified_date'] = date('Y-m-d H:i:s');
         $_POST['Restaurants']['id'] = Yii::app()->user->getId();
         $result = $model->updateRestaurantProfile($_POST['Restaurants'], $_FILES['Restaurants']);
     }
     $restaurant = $model->getRestaurantById(Yii::app()->user->getId());
     $this->render('profile', array('model' => $model, 'restaurant' => $restaurant['result']));
 }
Ejemplo n.º 2
0
 function createRestaurantBooking($bean, $nhahang = '')
 {
     global $db;
     $sql = "\r\n            SELECT \r\n              a.id \r\n            FROM\r\n              `restaurantbookings` a \r\n              JOIN `restaurantsrantbookings_c` b \r\n                ON a.`id` = b.`restaurantd663ookings_idb` \r\n                AND b.`deleted` = 0 \r\n                AND b.`restaurant437baurants_ida` = '{$nhahang->nh_id}' \r\n              JOIN `groupprograrantbookings_c` c \r\n                ON c.`groupprogre72bookings_idb` = a.`id` \r\n                AND c.`deleted` = 0 \r\n                AND c.`groupprogr880erograms_ida` = '{$bean->id}' \r\n            WHERE a.`deleted` = 0 \r\n            ";
     $RestaurantBooking = new RestaurantBookings();
     $result = $db->query($sql);
     while ($row = $db->fetchByAssoc($result)) {
         $RestaurantBooking->id = $row['id'];
     }
     $RestaurantBooking->groupprogratbookings_name = $bean->groupprogram_code;
     $RestaurantBooking->groupprogr880erograms_ida = $bean->id;
     $restaurant = new Restaurants();
     $restaurant->retrieve($nhahang->nh_id);
     $RestaurantBooking->restaurant437baurants_ida = $restaurant->id;
     $RestaurantBooking->restaurantstbookings_name = $restaurant->name;
     $RestaurantBooking->res_address = $restaurant->address;
     $RestaurantBooking->res_tel = $restaurant->tel;
     $RestaurantBooking->res_fax = $restaurant->fax;
     $RestaurantBooking->confirm = 0;
     $RestaurantBooking->name = 'Restaurant Bookings To ' . $restaurant->name;
     $RestaurantBooking->assigned_user_name = $bean->assigned_user_name;
     $RestaurantBooking->assigned_user_id = $bean->assigned_user_id;
     $return = $RestaurantBooking->save();
     return $return;
 }