예제 #1
0
 function listallAction()
 {
     ob_clean();
     $uid = $this->_getParam('uid');
     $unitModel = new RM_Units();
     $language = RM_Environment::getInstance()->getLocale();
     $unit = $unitModel->get($uid, $language);
     $priceObj = new RM_UnitDailyPrices();
     $prices = $priceObj->getCurrent($unit)->toArray();
     $this->view->unit = $unit;
     $this->view->prices = $prices;
     echo $this->view->render('DailyPrices/listall.phtml');
     die;
 }
예제 #2
0
 /**
  * @param   request ids  unit prices rows ids
  * @see modules/prices/js/unit_list.js
  * @return 	json    json array information: success of failure
  */
 function deleteJsonAction()
 {
     $priceIDs = $this->_getParam('ids', '');
     $model = new RM_UnitDailyPrices();
     foreach ($priceIDs as $priceID) {
         $price = $model->find($priceID)->current();
         $price->delete();
     }
     return array('data' => array('success' => true));
 }
예제 #3
0
 /**
  * Returns all unit ids that have price in price range in input period
  *
  * @param float $from
  * @param float $to
  * @param RM_Reservation_Period $period
  * @return array array with unit ids
  */
 public function getByPriceRange($from, $to, RM_Reservation_Period $period = null)
 {
     $model = new RM_UnitDailyPrices();
     $rows = $model->getByPriceRange($from, $to, $period);
     $unitIDs = array();
     foreach ($rows as $row) {
         $unitIDs[] = $row->unit_id;
     }
     return $unitIDs;
 }