コード例 #1
0
ファイル: CreateBetOddsTable.php プロジェクト: berksonj/bet
 private function setBetOddsTable()
 {
     $model = new Model_EventTypesValueModel();
     $model->addQuery('select', array('table' => $model->getTableName()));
     $eventTypesId = $this->getEventTypesId();
     if (is_numeric($eventTypesId)) {
         $model->addQuery('where', array('where_condition' => 'event_types_id_FK=' . $eventTypesId));
     }
     $model->addQuery('order', array('order' => implode($model->getPrimaryKeys(), ",") . ' DESC'));
     $valuesCollection = new Core_Model_Adapter_ModelCollection();
     $valuesCollection->getModelCollection($model);
     $this->betOddsTable->setData($valuesCollection->toArray());
     $this->betOddsTable->addColumn(array('key' => 'event_types_value_id', 'label' => 'ID'));
     $this->betOddsTable->addColumn(array('key' => 'event_value_name', 'label' => 'Name'));
     $this->betOddsTable->addColumn('{key:"event_types_value_id",label:"Odds",allowHTML:true,formatter:"<input class=\'oddsInput\' valueid=\'{value}\' value=\'1\' type=\'text\' />"}', false, 'active');
 }
コード例 #2
0
ファイル: OfferTableEvents.php プロジェクト: berksonj/bet
 private function setOfferTable()
 {
     $this->offerTable = new Extension_View_Yui35_DataTable();
     $eventTypesValues = new Model_EventTypesValueModel();
     $eventTypesValues->addQuery('select', array('table' => $eventTypesValues->getTableName()));
     $eventTypesId = $this->getEventTypesId();
     if (is_numeric($eventTypesId)) {
         $eventTypesValues->addQuery('where', array('where_condition' => 'event_types_id_FK=' . (int) $eventTypesId));
     } else {
         return;
     }
     $eventTypesValues->addQuery('order', array('order' => implode($eventTypesValues->getPrimaryKeys(), ",") . ' DESC'));
     $eventTypesValuesCoellction = new Core_Model_Adapter_ModelCollection();
     $eventTypesValuesCoellction->getModelCollection($eventTypesValues);
     $this->offerTable->addColumn(array('key' => 'event_bets_id', 'label' => 'ID'));
     $this->offerTable->addColumn(array('key' => 'event_bets_name', 'label' => 'Name'));
     $this->offerTable->addColumn(array('key' => 'end_date', 'label' => 'Ends'));
     foreach ($eventTypesValuesCoellction->toArray() as $a) {
         $this->offerTable->addColumn(array('key' => $a['event_types_value_id'], 'allowHTML' => true, 'formatter' => '<span class="betOfferElement">{value}</span>', 'label' => $a['event_value_name']));
     }
     $betsModel = new Model_BetsModel();
     $groupsId = $this->getGroupId();
     if (!is_numeric($groupsId)) {
         return;
     }
     $eventBetsInTable = $betsModel->completeBetData($groupsId, $eventTypesId)->executeQuery('fetchAssoc');
     $data = array();
     if (!is_array($eventBetsInTable)) {
         return;
     }
     foreach ($eventBetsInTable as $d) {
         $data[$d['event_bets_id']][$d['event_types_value_id_FK']] = $d['odd_value'];
         $data[$d['event_bets_id']]['event_bets_name'] = $d['event_bets_name'];
         $data[$d['event_bets_id']]['end_date'] = $d['end_date'];
         $data[$d['event_bets_id']]['event_bets_id'] = $d['event_bets_id'];
         $data[$d['event_bets_id']][$d['event_types_value_id_FK'] . '_odd_value_id'] = $d['odd_value_id'];
         $data[$d['event_bets_id']]['bets_id'] = $d['bets_id'];
     }
     $preperedTableArray = array();
     foreach ($data as $value) {
         $preperedTableArray[] = $value;
     }
     $this->offerTable->setData($preperedTableArray);
     return $this->offerTable;
 }
コード例 #3
0
ファイル: OfferTableEvents.php プロジェクト: berksonj/bet
 private function setOfferTable()
 {
     $offerTable = new Extension_View_Yui35_DataTableEdit();
     $offerTable->isAddButtonEnabled(false);
     $eventTypesValues = new Model_EventTypesValueModel();
     $eventTypesValues->addQuery('select', array('table' => $eventTypesValues->getTableName()));
     $model = new Model_EventBetsModel();
     $offerTable->setModel($model);
     $eventTypesId = $this->getEventTypesId();
     if (is_numeric($eventTypesId)) {
         $eventTypesValues->addQuery('where', array('where_condition' => 'event_types_id_FK=' . (int) $eventTypesId));
     } else {
         return;
     }
     $eventTypesValues->addQuery('order', array('order' => implode($eventTypesValues->getPrimaryKeys(), ",") . ' DESC'));
     $eventTypesValuesCoellction = new Core_Model_Adapter_ModelCollection();
     $eventTypesValuesCoellction->getModelCollection($eventTypesValues);
     $offerTable->getTable()->addColumn(array('key' => 'event_bets_id', 'label' => 'ID'));
     $offerTable->getTable()->addColumn(array('key' => 'event_bets_name', 'label' => 'Name'));
     $offerTable->getTable()->addColumn(array('key' => 'add_date', 'label' => 'Active'));
     $offerTable->getTable()->addColumn(array('key' => 'end_date', 'label' => 'Ends'));
     $offerTable->getTable()->addColumn(array('key' => 'score', 'label' => 'Score'));
     $offerTable->setUpdateRule('exclude', 'end_date');
     $offerTable->setUpdateRule('exclude', 'add_date');
     $offerTable->getTable()->addColumn('{key:"correct_type",label:"Correct Type",allowHTML:true,formatter:' . $offerTable->getTable()->getFormatter("selectFromModel", array('values' => $eventTypesValuesCoellction, 'value' => 'event_types_value_id', 'label' => 'event_value_name', 'attributes' => array('name' => 'model[' . $model->getModelClassName() . '][correct_type]'))) . '}', false, 'correct_type');
     foreach ($eventTypesValuesCoellction->toArray() as $a) {
         $offerTable->getTable()->addColumn(array('key' => $a['event_types_value_id'], 'allowHTML' => true, 'formatter' => '<span class="betOfferElement">{value}</span>', 'label' => $a['event_value_name']));
         $offerTable->setUpdateRule('exclude', $a['event_types_value_id']);
     }
     $groupsId = $this->getGroupId();
     if (!is_numeric($groupsId)) {
         return;
     }
     $offerTable->setUrl('filter', Application::getRouter()->getFullUrl(array('controller' => 'servicejson', 'action' => 'method', 'params' => 'method=completeEventBetDataArray&groups_id=' . $groupsId . '&event_types_id' . $eventTypesId)));
     $preperedTableArray = $model->completeEventBetDataArray($groupsId, $eventTypesId);
     $offerTable->getTable()->setData($preperedTableArray);
     return $this->offerTable = $offerTable;
 }