public function getGroupSelectHtml() { $groupsModel = new Model_GroupsModel(); $groupsModel->addQuery('select', array('table' => $groupsModel->getTableName())); $groupsCollection = new Core_Model_Adapter_ModelCollection(); $groupsCollectionData = $groupsCollection->getModelCollection($groupsModel); $select = new Extension_View_Html_Form_Elements_Select(); $select->setModel($groupsCollection->toArray()); $select->setAttribute('name', 'groups_id_FK'); $select->setOptionLabelKey('name_of_group'); $select->setOptionValueKey('groups_id'); return $select; }
public function setEventListWidget() { $list = new View_Admin_Widgets_EventTypesList(); $sportId = $this->getSportId(); if (!isset($sportId)) { $groupsId = $this->getGroupId(); if (isset($groupsId)) { $groupModel = new Model_GroupsModel(); $groupModel->load($groupsId); $sportId = $groupModel->getData('sports_id_FK'); if ($sportId) { $list->setSportId($sportId); } } } $this->eventListWidget = $list; }
public function setSelectElement() { $sportId = $this->getSportId(); $groupsModel = new Model_GroupsModel(); $groupsModel->addQuery('select', array('table' => $groupsModel->getTableName())); if (is_numeric($sportId)) { $groupsModel->addQuery('where', array('where_condition' => 'sports_id_FK=' . $sportId)); } $groupsCollection = new Core_Model_Adapter_ModelCollection(); $groupsCollectionData = $groupsCollection->getModelCollection($groupsModel); $select = new Extension_View_Html_Form_Elements_Select(); $select->setModel($groupsCollection->toArray()); $select->setAttribute('name', 'groups_id'); $select->setAttribute('id', $select->getId()); $select->setOptionLabelKey('name_of_group'); $select->setOptionValueKey('groups_id'); $this->select = $select; }
public function setBetsTablePanel() { $table = $this->betsTableWithPanel->getTable(); $this->betsTableWithPanel->isAddButtonEnabled(false); $model = new Model_BetsModel(); $model->addQuery('select', array('table' => $model->getTableName())); $model->addQuery('order', array('order' => implode($model->getPrimaryKeys(), ",") . ' DESC')); $model->addQuery('limit', array('limit' => 20)); $this->betsTableWithPanel->setModel($model); $table->addColumn(array('key' => 'bets_id', 'label' => 'ID')); $table->addColumn(array('key' => 'bet_name', 'label' => 'Name')); $groupsModel = new Model_GroupsModel(); $groupsModel->addQuery('select', array('table' => $groupsModel->getTableName())); $groupsCollection = new Core_Model_Adapter_ModelCollection(); $groupsCollectionData = $groupsCollection->getModelCollection($groupsModel); $table->addColumn('{key:"groups_id_FK",label:"Group",allowHTML:true,formatter:' . $table->getFormatter("selectFromModel", array('values' => $groupsCollectionData, 'value' => 'groups_id', 'label' => 'name_of_group', 'attributes' => array('name' => 'model[' . $this->betsTableWithPanel->getModelName() . '][groups_id_FK]'))) . '}', false, 'groups'); $table->addColumn(array('key' => 'bet_active', 'label' => 'Active')); $table->addColumn(array('key' => 'end_date', 'label' => 'Ends')); $select = new Extension_View_Html_Form_Elements_Select(); $select->setModel($groupsCollection->toArray()); $select->setAttribute('name', 'groups_id_FK'); $select->setOptionLabelKey('name_of_group'); $select->setOptionValueKey('groups_id'); $select->setPrependHtml('Group:'); $this->betsTableWithPanel->addFilter($select); $this->betsTableWithPanel->addFilterGroupOperators('active', 'and'); $this->betsTableWithPanel->addFilterGroupOperators('end', 'and'); $filterCalendar = new Extension_View_Html_Form_Elements_Calendar(); $filterCalendar->setPrependHtml('Active from:'); $filterCalendar->setAttribute('name', 'bet_active'); $this->betsTableWithPanel->addFilter($filterCalendar, array('group' => 'active', 'operator' => 'and', 'comparison' => '>')); $filterCalendar = new Extension_View_Html_Form_Elements_Calendar(); $filterCalendar->setPrependHtml('Active to:'); $filterCalendar->setAttribute('name', 'bet_active'); $this->betsTableWithPanel->addFilter($filterCalendar, array('group' => 'active', 'operator' => 'and', 'comparison' => '<')); $filterCalendar = new Extension_View_Html_Form_Elements_Calendar(); $filterCalendar->setPrependHtml('End from:'); $filterCalendar->setAttribute('name', 'end_date'); $this->betsTableWithPanel->addFilter($filterCalendar, array('group' => 'end', 'operator' => 'and', 'comparison' => '>')); $filterCalendar = new Extension_View_Html_Form_Elements_Calendar(); $filterCalendar->setPrependHtml('End to:'); $filterCalendar->setAttribute('name', 'end_date'); $this->betsTableWithPanel->addFilter($filterCalendar, array('group' => 'end', 'operator' => 'and', 'comparison' => '<')); }
private function setTeamsTablePanel() { $table = $this->teamsTableWithPanel->getTable(); $model = new Model_TeamsModel(); $model->addQuery('select', array('table' => $model->getTableName())); $model->addQuery('order', array('order' => implode($model->getPrimaryKeys(), ",") . ' DESC')); $model->addQuery('limit', array('limit' => 20)); $this->teamsTableWithPanel->setModel($model); $table->addColumn(array('key' => 'teams_id', 'label' => 'ID')); $table->addColumn(array('key' => 'team_name', 'label' => 'Name')); $groupsModel = new Model_GroupsModel(); $groupsModel->addQuery('select', array('table' => $groupsModel->getTableName())); $groupsCollection = new Core_Model_Adapter_ModelCollection(); $groupsCollectionData = $groupsCollection->getModelCollection($groupsModel); $table->addColumn('{key:"groups_id_FK",label:"Group",allowHTML:true,formatter:' . $table->getFormatter("selectFromModel", array('values' => $groupsCollectionData, 'value' => 'groups_id', 'label' => 'name_of_group', 'attributes' => array('name' => 'model[' . $this->teamsTableWithPanel->getModelName() . '][groups_id_FK]'))) . '}', false, 'groups'); $select = new Extension_View_Html_Form_Elements_Select(); $select->setModel($groupsCollection->toArray()); $select->setAttribute('name', 'groups_id_FK'); $select->setOptionLabelKey('name_of_group'); $select->setOptionValueKey('groups_id'); $this->teamsTableWithPanel->addFilter($select); }
public function setMenu() { $url = Application::getRouter()->getFullUrl(array('controller' => 'servicehtml', 'action' => 'view')); $menu = new Extension_View_Yui35_Menu(); $menu->setDirection('horizontal'); $sportsModel = new Model_SportsModel(); $sportsModel->addQuery('select', array('table' => $sportsModel->getTableName())); $sportsCollection = new Core_Model_Adapter_ModelCollection(); $sportsCollection->getModelCollection($sportsModel); foreach ($sportsCollection->toArray() as $s) { $menu->addLink('sport_' . $s['sports_id'], array('content' => $s['name_of_sport'])); $menu->addChild('menu', 'sport_' . $s['sports_id']); } $groupsModel = new Model_GroupsModel(); $groupsModel->addQuery('select', array('table' => $groupsModel->getTableName())); $groupsCollection = new Core_Model_Adapter_ModelCollection(); $groupsCollection->getModelCollection($groupsModel); foreach ($groupsCollection->toArray() as $g) { $menu->addLink('group_' . $g['groups_id'], array('content' => $g['name_of_group'], 'attributes' => array('class' => 'systemServiceLink', 'servicehtml' => $url . '&view=View_Frontend_Offer&groups_id=' . $g['groups_id']))); $menu->addChild('sport_' . $g['sports_id_FK'], 'group_' . $g['groups_id']); } $this->menu = $menu; }