コード例 #1
0
 public function findallAction()
 {
     if ($this->getRequest()->getParam('value_id')) {
         // Social Gaming
         $application = $this->getApplication();
         $option = $this->getCurrentOptionValue();
         $offset = $this->getRequest()->getParam('offset', 0);
         $current_game = new Socialgaming_Model_Game();
         $current_game->findCurrent($option->getId());
         if (!$current_game->getId()) {
             $current_game->findDefault();
         }
         list($start, $end) = $current_game->getFromDateToDate();
         $log = new LoyaltyCard_Model_Customer_Log();
         $customers = $log->getBestCustomers($application->getId(), $start->toString('y-MM-dd HH:mm:ss'), $end->toString('y-MM-dd HH:mm:ss'), false, $offset);
         $team_leader = $customers->current();
         $customers->removeCurrent();
         $data = array("icon_url" => $this->_getColorizedImage($option->getIconId(), $application->getBlock('background')->getColor()), "game" => array("period" => strtoupper($current_game->getGamePeriodLabel())), "team_leader" => array(), "collection" => array());
         if ($team_leader) {
             $data["team_leader"] = array("id" => $team_leader->getId(), "image_url" => $team_leader->getImageLink(), "name" => $team_leader->getFirstname() . ' ' . mb_substr($team_leader->getLastname(), 0, 1, "UTF-8") . '.', "number_of_points" => $this->_('%s point%s', $team_leader->getNumberOfPoints(), $team_leader->getNumberOfPoints() > 1 ? 's' : ''));
         }
         if ($customers->count()) {
             foreach ($customers as $customer) {
                 $data["collection"][] = array("id" => $customer->getId(), "image_url" => $customer->getImageLink(), "name" => $customer->getFirstname() . ' ' . mb_substr($customer->getLastname(), 0, 1, "UTF-8") . '.', "number_of_points" => $this->_('%s point%s', $customer->getNumberOfPoints(), $customer->getNumberOfPoints() > 1 ? 's' : ''));
             }
         }
         $data['page_title'] = $option->getTabbarName();
         $this->_sendHtml($data);
     }
 }
コード例 #2
0
 public function viewAction()
 {
     // Sociel Gaming
     $app = $this->getApplication();
     $option = $this->getCurrentOptionValue();
     $current_game = new Socialgaming_Model_Game();
     $current_game->findCurrent($app->getId());
     if (!$current_game->getId()) {
         $current_game->findDefault();
     }
     list($start, $end) = $current_game->getFromDateToDate();
     $log = new LoyaltyCard_Model_Customer_Log();
     $customers = $log->getBestCustomers($app->getId(), $start->toString('y-MM-dd HH:mm:ss'), $end->toString('y-MM-dd HH:mm:ss'), false);
     $team_leader = $customers->current();
     $customers->removeCurrent();
     $this->loadPartials($this->getFullActionName('_') . '_l' . $this->_layout_id, false);
     $this->getLayout()->getPartial('content')->setCurrentGame($current_game)->setTeamLeader($team_leader)->setCustomers($customers);
     $html = array('html' => $this->getLayout()->render());
     if ($url = $option->getBackgroundImageUrl()) {
         $html['background_image_url'] = $url;
     }
     $html['use_homepage_background_image'] = (int) $option->getUseHomepageBackgroundImage() && !$option->getHasBackgroundImage();
     $html['title'] = $option->getTabbarName();
     $this->getLayout()->setHtml(Zend_Json::encode($html));
 }
コード例 #3
0
ファイル: Customer.php プロジェクト: bklein01/SiberianCMS
 public function createLog($password_id, $nbr, $created_at = null)
 {
     $log = new LoyaltyCard_Model_Customer_Log();
     $log->setCardId($this->getCardId())->setCustomerId($this->getCustomerId())->setPasswordId($password_id)->setNumberOfPoints($nbr);
     if ($created_at) {
         $log->setCreatedAt($created_at);
     }
     $log->save();
     return $this;
 }