max_rating = VmConfig::get('vm_maximum_rating_scale',5); $model = VmModel::getModel(); $this->SetViewTitle('REVIEW_RATE' ); /* Get the task */ $task = vRequest::getCmd('task'); $new = false; vmdebug('my task',$task); switch ($task) { case 'edit': /* Get the data $rating = $model->getRating($cids); $this->addStandardEditViewCommands(); break;*/ case 'listreviews': $this->setLayout('list_reviews'); $this->addStandardDefaultViewLists($model); $virtuemart_product_id = vRequest::getInt('virtuemart_product_id'); if(is_array($virtuemart_product_id) && count($virtuemart_product_id) > 0){ $virtuemart_product_id = (int)$virtuemart_product_id[0]; } else { $virtuemart_product_id = (int)$virtuemart_product_id; } $this->reviewslist = $model->getReviews($virtuemart_product_id, vmAccess::getVendorId()); $lists = array(); $lists['filter_order'] = $mainframe->getUserStateFromRequest($option.'filter_order', 'filter_order', '', 'cmd'); $lists['filter_order_Dir'] = $mainframe->getUserStateFromRequest($option.'filter_order_Dir', 'filter_order_Dir', '', 'word'); $this->pagination = $model->getPagination(); $this->addStandardDefaultViewCommands(true,true); break; case 'add': $new = true; $cids = vRequest::getInt('virtuemart_product_id',0); case 'edit_review': $this->setLayout('edit_review'); JToolBarHelper::divider(); // Get the data $this->rating = $model->getReview($cids,$new); //vmdebug('$this->rating',$this->rating); if(!empty($this->rating)){ $this->SetViewTitle('REVIEW_RATE',$this->rating->product_name." (". $this->rating->customer.")" ); JToolBarHelper::custom('saveReview', 'save', 'save', vmText::_('COM_VIRTUEMART_SAVE'), false); JToolBarHelper::custom('applyReview', 'apply', 'apply', vmText::_('COM_VIRTUEMART_APPLY'), false); } else { $this->SetViewTitle('REVIEW_RATE','ERROR' ); } JToolBarHelper::custom('cancelEditReview', 'cancel', 'cancel', vmText::_('COM_VIRTUEMART_CANCEL'), false); break; default: $this->addStandardDefaultViewCommands(false, true); $this->addStandardDefaultViewLists($model); $this->ratingslist = $model->getRatings(); $this->pagination = $model->getPagination(); vmdebug('Got default'); break; } parent::display($tpl); } } // pure php no closing tag