当前位置: 首页>>代码示例>>PHP>>正文


PHP Field::load方法代码示例

本文整理汇总了PHP中Field::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Field::load方法的具体用法?PHP Field::load怎么用?PHP Field::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Field的用法示例。


在下文中一共展示了Field::load方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: process

 function process()
 {
     global $lr_session;
     $this->title = $this->team->name;
     $this->template_name = 'pages/team/view.tpl';
     $this->smarty->assign('team', $this->team);
     if ($this->team->home_field) {
         $field = Field::load(array('fid' => $this->team->home_field));
         $this->smarty->assign('home_field', $field);
     }
     $teamSBF = $this->team->calculate_sbf();
     if ($teamSBF) {
         $this->smarty->assign('team_sbf', $teamSBF);
         $league = League::load(array('league_id' => $this->team->league_id));
         $this->smarty->assign('league_sbf', $league->calculate_sbf());
     }
     if ($lr_session->has_permission('team', 'player shirts', $this->team->team_id)) {
         $this->smarty->assign('display_shirts', true);
     }
     $rosterPositions = Team::get_roster_positions();
     $this->smarty->assign('roster_positions', $rosterPositions);
     $this->team->get_roster();
     $this->team->check_roster_conflict();
     foreach ($this->team->roster as $player) {
         $player->status = $rosterPositions[$player->status];
     }
     $min_roster = $league->min_roster_size;
     if ($this->team->roster_count < $min_roster && ($lr_session->is_captain_of($this->team->team_id) || $lr_session->is_admin()) && $this->team->roster_deadline > 0) {
         $this->smarty->assign('roster_requirement', $min_roster);
         $this->smarty->assign('display_roster_note', true);
     }
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:33,代码来源:view.php

示例2: process

 function process()
 {
     global $CONFIG;
     $this->template_name = 'pages/team/ical.tpl';
     $this->smarty->assign('team', $this->team);
     $this->smarty->assign('short_league_name', variable_get('app_org_short_name', 'League'));
     # Our timezone is specified as US/Eastern, but ical wants US-Eastern.  bleh.
     $timezone = preg_replace("!/!", "-", $CONFIG['localization']['local_tz']);
     $this->smarty->assign('timezone', $timezone);
     /*
      * Grab schedule info
      */
     $games = Game::load_many(array('either_team' => $this->team->team_id, 'published' => 1, '_order' => 'g.game_date DESC,g.game_start,g.game_id'));
     // We'll be outputting an ical
     header('Content-type: text/calendar; charset=UTF-8');
     // Prevent caching
     header("Cache-Control: no-cache, must-revalidate");
     // get domain URL for signing games
     $arr = explode('@', variable_get('app_admin_email', "@{$short_league_name}"));
     $this->smarty->assign('domain_url', $arr[1]);
     // date stamp this file
     // MUST be in UTC
     $this->smarty->assign('now', gmstrftime('%Y%m%dT%H%M%SZ'));
     while (list(, $game) = each($games)) {
         $opponent_id = $game->home_id == $this->team->team_id ? $game->away_id : $game->home_id;
         $game->opponent = Team::load(array('team_id' => $opponent_id));
         $game->field = Field::load(array('fid' => $game->fid));
     }
     $this->smarty->assign('games', $games);
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:30,代码来源:ical.php

示例3: __construct

 function __construct($id)
 {
     $this->field = Field::load(array('fid' => $id));
     if (!$this->field) {
         error_exit("That field does not exist");
     }
     field_add_to_menu($this->field);
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:8,代码来源:FieldHandler.php

示例4: __construct

 function __construct($load_mode = LOAD_RELATED_DATA)
 {
     // If we have a parent, override the overridables.
     if ($this->parent_fid) {
         $parent = Field::load(array('fid' => $this->parent_fid));
         $this->name = $parent->name;
         $this->code = $parent->code;
         $this->region = $parent->region;
         $this->location_street = $parent->location_street;
         $this->location_city = $parent->location_city;
         $this->location_province = $parent->location_province;
         $this->location_country = $parent->location_country;
         $this->driving_directions = $parent->driving_directions;
         $this->transit_directions = $parent->transit_directions;
         $this->biking_directions = $parent->biking_directions;
         $this->parking_details = $parent->parking_details;
         $this->washrooms = $parent->washrooms;
         $this->public_instructions = $parent->public_instructions;
         $this->site_instructions = $parent->site_instructions;
         $this->sponsor = $parent->sponsor;
         $this->location_url = $parent->location_url;
         $this->layout_url = $parent->layout_url;
         $this->fullname = join(" ", array($this->name, $this->num));
         $this->is_indoor = $parent->is_indoor;
         // Fields may have their own parking details, or inherit from the parent
         if (!$this->parking) {
             $this->parking = $parent->parking;
         }
     }
     if ($load_mode == LOAD_OBJECT_ONLY) {
         return;
     }
     $current_season_id = strtolower(variable_get("current_season", 1));
     $current_season = Season::load(array('id' => $current_season_id));
     $permit_dir = join("/", array(strtolower($current_season->season), $current_season->year, 'permits'));
     $system_permit_dir = join("/", array(variable_get("league_file_base", '/opt/websites/www.ocua.ca/static-content/leagues'), $permit_dir));
     # Auto-detect the permit URLs
     $this->permit_url = '';
     if (is_dir($system_permit_dir)) {
         if ($dh = opendir($system_permit_dir)) {
             while (($file = readdir($dh)) !== false) {
                 if (fnmatch($this->code . "*", $file)) {
                     $this->permit_url .= l($file, variable_get("league_url_base", 'http://www.ocua.ca/leagues') . "/{$permit_dir}/{$file}\"") . '<br />';
                 }
             }
         }
     }
     if (!$this->rating) {
         # If no rating, mark as unknown
         $this->rating = '?';
     }
     return true;
 }
开发者ID:h07r0d,项目名称:leaguerunner,代码行数:53,代码来源:field.php

示例5: __construct

 function __construct()
 {
     global $dbh;
     $sth = $dbh->prepare('SELECT league_id from league_gameslot_availability WHERE slot_id = ?');
     $sth->execute(array($this->slot_id));
     $this->leagues = array();
     while ($league = $sth->fetch(PDO::FETCH_OBJ)) {
         $league->league_status = 'loaded';
         $this->leagues[$league->league_id] = $league;
     }
     /* set derived attributes */
     if ($this->fid) {
         $this->field = Field::load(array('fid' => $this->fid));
     }
     return true;
 }
开发者ID:h07r0d,项目名称:leaguerunner,代码行数:16,代码来源:slot.php

示例6: generateConfirm

 function generateConfirm($edit)
 {
     $dataInvalid = $this->isDataInvalid($edit);
     if ($dataInvalid) {
         error_exit($dataInvalid . "<br>Please use your back button to return to the form, fix these errors, and try again");
     }
     $output = form_hidden("edit[step]", "perform");
     $ratings = field_rating_values();
     if ($edit['parent_fid']) {
         $parent = Field::load(array('fid' => $edit['parent_fid']));
         $rows = array();
         $rows[] = array("Name:", $parent->name);
         $rows[] = array("Status:", form_hidden('edit[status]', $edit['status']) . check_form($edit['status']));
         $rows[] = array("Number:", form_hidden('edit[num]', $edit['num']) . check_form($edit['num']));
         $rows[] = array("Field&nbsp;Rating:", form_hidden('edit[rating]', $edit['rating']) . $ratings[$edit['rating']]);
         $rows[] = array("Parent&nbsp;Field:", form_hidden('edit[parent_fid]', $edit['parent_fid']) . $parent->fullname);
     } else {
         $rows = array();
         $rows[] = array("Name:", form_hidden('edit[name]', $edit['name']) . check_form($edit['name']));
         $rows[] = array("Status:", form_hidden('edit[status]', $edit['status']) . check_form($edit['status']));
         $rows[] = array("Number:", form_hidden('edit[num]', $edit['num']) . check_form($edit['num']));
         $rows[] = array("Field&nbsp;Rating:", form_hidden('edit[rating]', $edit['rating']) . $ratings[$edit['rating']]);
         $rows[] = array("Is indoor:", form_hidden('edit[is_indoor]', $edit['is_indoor']) . ($edit['is_indoor'] ? 'Yes' : 'No'));
         $rows[] = array("Code:", form_hidden('edit[code]', $edit['code']) . check_form($edit['code']));
         $rows[] = array("Region:", form_hidden('edit[region]', $edit['region']) . check_form($edit['region']));
         $rows[] = array("Street:", form_hidden('edit[location_street]', $edit['location_street']) . check_form($edit['location_street']));
         $rows[] = array("City:", form_hidden('edit[location_city]', $edit['location_city']) . check_form($edit['location_city']));
         $rows[] = array("Province:", form_hidden('edit[location_province]', $edit['location_province']) . check_form($edit['location_province']));
         $rows[] = array("Location&nbsp;Map:", form_hidden('edit[location_url]', $edit['location_url']) . check_form($edit['location_url']));
         $rows[] = array("Layout&nbsp;Map:", form_hidden('edit[layout_url]', $edit['layout_url']) . check_form($edit['layout_url']));
         $rows[] = array("Driving Directions:", form_hidden('edit[driving_directions]', $edit['driving_directions']) . check_form($edit['driving_directions']));
         $rows[] = array("Parking Details:", form_hidden('edit[parking_details]', $edit['parking_details']) . check_form($edit['parking_details']));
         $rows[] = array("Transit Directions:", form_hidden('edit[transit_directions]', $edit['transit_directions']) . check_form($edit['transit_directions']));
         $rows[] = array("Biking Directions:", form_hidden('edit[biking_directions]', $edit['biking_directions']) . check_form($edit['biking_directions']));
         $rows[] = array("Public Washrooms:", form_hidden('edit[washrooms]', $edit['washrooms']) . check_form($edit['washrooms']));
         $rows[] = array("Special Instructions:", form_hidden('edit[public_instructions]', $edit['public_instructions']) . check_form($edit['public_instructions']));
         $rows[] = array("Private Instructions:", form_hidden('edit[site_instructions]', $edit['site_instructions']) . check_form($edit['site_instructions']));
         $rows[] = array("Sponsorship:", form_hidden('edit[sponsor]', $edit['sponsor']) . check_form($edit['sponsor']));
     }
     $rows[] = array(form_submit('Submit'), "");
     $output .= "<div class='pairtable'>" . table(null, $rows) . "</div>";
     return form($output);
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:43,代码来源:edit.php

示例7: process

 function process()
 {
     $this->template_name = 'pages/fieldreport/day.tpl';
     list($year, $month, $day) = preg_split("/[\\/-]/", $_GET['date']);
     $today = getdate();
     $yyyy = is_numeric($year) ? $year : $today['year'];
     $mm = is_numeric($month) ? $month : $today['mon'];
     $dd = is_numeric($day) ? $day : $today['mday'];
     if (!validate_date_input($yyyy, $mm, $dd)) {
         error_exit('That date is not valid');
     }
     $this->smarty->assign('date', sprintf("%4d/%02d/%02d", $yyyy, $mm, $dd));
     $formattedDay = strftime('%A %B %d %Y', mktime(6, 0, 0, $mm, $dd, $yyyy));
     $this->title = "Field Reports &raquo; {$formattedDay}";
     $sth = FieldReport::query(array('date_played' => sprintf('%d-%d-%d', $yyyy, $mm, $dd), '_order' => 'field_id ASC'));
     $reports = array();
     while ($r = $sth->fetchObject('FieldReport')) {
         $r->field = Field::load(array('fid' => $r->field_id));
         $reports[] = $r;
     }
     $this->smarty->assign('reports', $reports);
     return true;
 }
开发者ID:roboshed,项目名称:leaguerunner,代码行数:23,代码来源:day.php

示例8: __form

 private function __form(Section $existing = null)
 {
     // Status message:
     $callback = Administration::instance()->getPageCallback();
     if (isset($callback['flag']) && !is_null($callback['flag'])) {
         switch ($callback['flag']) {
             case 'saved':
                 $this->alerts()->append(__('Section updated at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/blueprints/sections/new/', ADMIN_URL . '/blueprints/sections/')), AlertStack::SUCCESS);
                 break;
             case 'created':
                 $this->alerts()->append(__('Section created at %1$s. <a href="%2$s">Create another?</a> <a href="%3$s">View all</a>', array(DateTimeObj::getTimeAgo(__SYM_TIME_FORMAT__), ADMIN_URL . '/blueprints/sections/new/', ADMIN_URL . '/blueprints/sections/')), AlertStack::SUCCESS);
                 break;
         }
     }
     if (!$this->alerts()->valid() and $existing instanceof Section) {
         $this->appendSyncAlert();
     }
     $layout = new Layout();
     $left = $layout->createColumn(Layout::SMALL);
     $right = $layout->createColumn(Layout::LARGE);
     $this->setTitle(__('%1$s &ndash; %2$s', array(__('Symphony'), __('Sections'))));
     $this->appendSubheading($existing instanceof Section ? $existing->name : __('New Section'));
     if ($existing instanceof Section) {
         $this->appendViewOptions();
     }
     // Essentials:
     $fieldset = $this->createElement('fieldset');
     $fieldset->setAttribute('class', 'settings');
     $fieldset->appendChild($this->createElement('h3', __('Essentials')));
     $label = Widget::Label('Name');
     $label->appendChild(Widget::Input('essentials[name]', $this->section->name));
     $fieldset->appendChild(isset($this->errors->name) ? Widget::wrapFormElementWithError($label, $this->errors->name) : $label);
     $label = Widget::Label(__('Navigation Group'));
     $label->appendChild($this->createElement('em', __('Created if does not exist')));
     $label->appendChild(Widget::Input('essentials[navigation-group]', $this->section->{"navigation-group"}));
     $fieldset->appendChild(isset($this->errors->{'navigation-group'}) ? Widget::wrapFormElementWithError($label, $this->errors->{'navigation-group'}) : $label);
     $navigation_groups = Section::fetchUsedNavigationGroups();
     if (is_array($navigation_groups) && !empty($navigation_groups)) {
         $ul = $this->createElement('ul', NULL, array('class' => 'tags singular'));
         foreach ($navigation_groups as $g) {
             $ul->appendChild($this->createElement('li', $g));
         }
         $fieldset->appendChild($ul);
     }
     $input = Widget::Input('essentials[hidden-from-publish-menu]', 'yes', 'checkbox', $this->section->{'hidden-from-publish-menu'} == 'yes' ? array('checked' => 'checked') : array());
     $label = Widget::Label(__('Hide this section from the Publish menu'));
     $label->prependChild($input);
     $fieldset->appendChild($label);
     $left->appendChild($fieldset);
     // Fields
     $fieldset = $this->createElement('fieldset');
     $fieldset->setAttribute('class', 'settings');
     $fieldset->appendChild($this->createElement('h3', __('Fields')));
     $div = $this->createElement('div');
     $h3 = $this->createElement('h3', __('Fields'));
     $h3->setAttribute('class', 'label');
     $div->appendChild($h3);
     $duplicator = new Duplicator(__('Add Field'));
     $duplicator->setAttribute('id', 'section-duplicator');
     $fields = $this->section->fields;
     $types = array();
     foreach (new FieldIterator() as $pathname) {
         $type = preg_replace(array('/^field\\./', '/\\.php$/'), NULL, basename($pathname));
         $types[$type] = Field::load($pathname);
     }
     // To Do: Sort this list based on how many times a field has been used across the system
     uasort($types, create_function('$a, $b', 'return strnatcasecmp($a->name(), $b->name());'));
     if (is_array($types)) {
         foreach ($types as $type => $field) {
             $defaults = array();
             $field->findDefaultSettings($defaults);
             $field->section = $this->section->handle;
             foreach ($defaults as $key => $value) {
                 $field->{$key} = $value;
             }
             $item = $duplicator->createTemplate($field->name());
             $field->displaySettingsPanel($item, new MessageStack());
         }
     }
     if (is_array($fields)) {
         foreach ($fields as $position => $field) {
             $field->sortorder = $position;
             if ($this->errors->{"field::{$position}"}) {
                 $messages = $this->errors->{"field::{$position}"};
             } else {
                 $messages = new MessageStack();
             }
             $item = $duplicator->createInstance($field->name, $field->name());
             $field->displaySettingsPanel($item, $messages);
         }
     }
     $duplicator->appendTo($fieldset);
     $right->appendChild($fieldset);
     $layout->appendTo($this->Form);
     $div = $this->createElement('div');
     $div->setAttribute('class', 'actions');
     $div->appendChild(Widget::Submit('action[save]', $this->_context[0] == 'edit' ? __('Save Changes') : 'Create Section', array('accesskey' => 's')));
     if ($this->_context[0] == 'edit') {
         $div->appendChild(Widget::Submit('action[delete]', __('Delete'), array('class' => 'confirm delete', 'title' => __('Delete this section'))));
     }
//.........这里部分代码省略.........
开发者ID:brendo,项目名称:symphony-3,代码行数:101,代码来源:content.blueprintssections.php

示例9: generateForm

 function generateForm()
 {
     global $lr_session;
     # Alias, to avoid typing.  Bleh.
     $game =& $this->game;
     $league =& $this->league;
     $game->load_score_entries();
     $output = form_hidden('edit[step]', 'confirm');
     $teams = $league->teams_as_array();
     /* Now, since teams may not be in league any longer, we need to force
      * them to appear in the pulldown
      */
     $teams[$game->home_id] = $game->home_name;
     $teams[$game->away_id] = $game->away_name;
     $output .= form_item("League/Division", l($league->fullname, "league/view/{$league->league_id}"));
     $output .= form_item("Home Team", l($game->home_name, "team/view/{$game->home_id}"));
     $output .= form_item("Away Team", l($game->away_name, "team/view/{$game->away_id}"));
     $output .= form_item("Date and Time", "{$game->game_date}, {$game->game_start} until " . $game->display_game_end() . $note);
     $field = Field::load(array('fid' => $game->fid));
     $output .= form_item("Location", l("{$field->fullname} ({$game->field_code})", "field/view/{$game->fid}"), $note);
     if ($lr_session->is_coordinator_of($game->league_id)) {
         $output .= form_item("Site Ranking (home team)", $game->get_site_ranking($game->home_id));
         $output .= form_item("Site Ranking (away team)", $game->get_site_ranking($game->away_id));
     }
     $output .= form_item("Game Status", $game->status);
     if (isset($game->round)) {
         $output .= form_item("Round", $game->round);
     }
     $spirit_group = '';
     $score_group = '';
     /*
      * Now, for scores and spirit info.  Possibilities:
      *  - game has been finalized:
      *  	- everyone can see scores
      *  	- coordinator can edit scores/spirit
      *  - game has not been finalized
      *  	- players only see "not yet submitted"
      *  	- captains can see submitted scores
      *  	- coordinator can see everything, edit final scores/spirit
      */
     if ($game->approved_by) {
         // Game has been finalized
         if (!$this->can_edit) {
             // If we're not editing, display score.  If we are,
             // it will show up below.
             switch ($game->status) {
                 case 'home_default':
                     $home_status = " (defaulted)";
                     break;
                 case 'away_default':
                     $away_status = " (defaulted)";
                     break;
                 case 'forfeit':
                     $home_status = " (forfeit)";
                     $away_status = " (forfeit)";
                     break;
             }
             $score_group .= form_item("Home ({$game->home_name} [rated: {$game->rating_home}]) Score", "{$game->home_score} {$home_status}");
             $score_group .= form_item("Away ({$game->away_name} [rated: {$game->rating_away}]) Score", "{$game->away_score} {$away_status}");
         }
         if ($game->home_score == $game->away_score && $game->rating_points == 0) {
             $score_group .= form_item("Rating Points", "No points were transferred between teams");
         } else {
             if ($game->home_score >= $game->away_score) {
                 $winner = l($game->home_name, "team/view/{$game->home_id}");
                 $loser = l($game->away_name, "team/view/{$game->away_id}");
             } elseif ($game->home_score < $game->away_score) {
                 $winner = l($game->away_name, "team/view/{$game->away_id}");
                 $loser = l($game->home_name, "team/view/{$game->home_id}");
             }
             $score_group .= form_item("Rating Points", $game->rating_points, $winner . " gain " . $game->rating_points . " points and " . $loser . " lose " . $game->rating_points . " points");
         }
         switch ($game->approved_by) {
             case APPROVAL_AUTOMATIC:
                 $approver = 'automatic approval';
                 break;
             case APPROVAL_AUTOMATIC_HOME:
                 $approver = 'automatic approval using home submission';
                 break;
             case APPROVAL_AUTOMATIC_AWAY:
                 $approver = 'automatic approval using away submission';
                 break;
             case APPROVAL_AUTOMATIC_FORFEIT:
                 $approver = 'game automatically forfeited due to lack of score submission';
                 break;
             default:
                 $approver = Person::load(array('user_id' => $game->approved_by));
                 $approver = l($approver->fullname, "person/view/{$approver->user_id}");
         }
         $score_group .= form_item("Score Approved By", $approver);
     } else {
         /*
          * Otherwise, scores are still pending.
          */
         if ($lr_session->is_coordinator_of($game->league_id)) {
             $list = player_rfc2822_address_list($game->get_captains(), true);
             $output .= para(l('Click here to send an email', "mailto:{$list}") . ' to all captains.');
         }
         $stats_group = '';
         /* Use our ratings to try and predict the game outcome */
//.........这里部分代码省略.........
开发者ID:roboshed,项目名称:leaguerunner,代码行数:101,代码来源:edit.php


注:本文中的Field::load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。