本文整理汇总了PHP中extract_values函数的典型用法代码示例。如果您正苦于以下问题:PHP extract_values函数的具体用法?PHP extract_values怎么用?PHP extract_values使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了extract_values函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
public function edit()
{
date_default_timezone_set("Europe/Oslo");
$date = new DateTime(phpgw::get_var('date'));
$system_message = array();
$system_message['building_id'] = intval(phpgw::get_var('building_id', 'GET'));
$system_message['building_name'] = phpgw::get_var('building_name', 'GET');
$system_message['cancel_link'] = self::link(array('menuaction' => $this->module . '.uisearch.index'));
$system_message['created'] = $date->format('Y-m-d H:m');
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$system_message = array_merge($system_message, extract_values($_POST, array('time', 'title', 'message', 'name', 'phone', 'email')));
if ($system_message['message'] == '') {
$errors['system_message'] = lang('Missing title');
} elseif ($system_message['title'] == '') {
$errors['system_message'] = lang('Missing message');
} elseif ($system_message['name'] == '') {
$errors['system_message'] = lang('Missing name');
}
if (!$errors) {
$system_message['title'] = $system_message['building_name'] . " - " . $system . $system_message['title'];
$receipt = $this->bo->add($system_message);
$this->redirect(array('menuaction' => $this->module . '.uibuilding.show.index', 'id' => $system_message['building_id']));
}
}
$this->flash_form_errors($errors);
$this->use_yui_editor();
self::render_template('system_message', array('system_message' => $system_message));
}
示例2: edit
public function edit()
{
$id = intval(phpgw::get_var('id', 'GET'));
$resource = $this->bo->read_single($id);
$resource['id'] = $id;
$resource['building_link'] = self::link(array('menuaction' => 'booking.uibuilding.show', 'id' => $resource['id']));
$resource['buildings_link'] = self::link(array('menuaction' => 'booking.uibuilding.index'));
$resource['cancel_link'] = self::link(array('menuaction' => 'booking.uiresource.index'));
$resource['types'] = $this->resource_types();
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$resource = array_merge($resource, extract_values($_POST, $this->fields));
$errors = $this->bo->validate($resource);
if (!$errors) {
$receipt = $this->bo->update($resource);
$this->redirect(array('menuaction' => 'booking.uiresource.show', 'id' => $resource['id']));
}
}
$this->flash_form_errors($errors);
self::add_javascript('booking', 'booking', 'resource_new.js');
phpgwapi_yui::load_widget('datatable');
phpgwapi_yui::load_widget('autocomplete');
$activity_data = $this->activity_bo->fetch_activities();
foreach ($activity_data['results'] as $acKey => $acValue) {
$activity_data['results'][$acKey]['resource_id'] = $resource['activity_id'];
}
$this->use_yui_editor();
self::render_template('resource_form', array('resource' => $resource, 'activitydata' => $activity_data));
}
示例3: edit
public function edit()
{
$id = intval(phpgw::get_var('id', 'GET'));
if ($id) {
$person = $this->bo->read_single($id);
$person['id'] = $id;
$person['contactpersons_link'] = self::link(array('menuaction' => 'booking.uicontactperson.index'));
$person['edit_link'] = self::link(array('menuaction' => 'booking.uicontactperson.edit', 'id' => $person['id']));
} else {
$person = array();
}
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$person = array_merge($person, extract_values($_POST, array('ssn', 'name', 'homepage', 'phone', 'email', 'description')));
$errors = $this->bo->validate($person);
if (!$errors) {
if ($id) {
$receipt = $this->bo->update($person);
} else {
$receipt = $this->bo->add($person);
}
$this->redirect(array('menuaction' => $this->module . '.uicontactperson.show', 'id' => $receipt['id']));
}
}
$this->flash_form_errors($errors);
self::add_stylesheet('phpgwapi/js/yahoo/assets/skins/sam/skin.css');
self::add_javascript('yahoo', 'yahoo/yahoo-dom-event', 'yahoo-dom-event.js');
self::add_javascript('yahoo', 'yahoo/element', 'element-min.js');
self::add_javascript('yahoo', 'yahoo/dom', 'dom-min.js');
self::add_javascript('yahoo', 'yahoo/container', 'container_core-min.js');
self::add_javascript('yahoo', 'yahoo/editor', 'simpleeditor-min.js');
self::add_template_file("contactperson_fields");
self::render_template('contactperson_edit', array('person' => $person));
}
示例4: generate_allocation
function generate_allocation($season_id, $date, $to, $interval, $write = false)
{
$season = $this->so->read_single($season_id);
$this->authorize_write($season_id);
$valid = array();
$invalid = array();
do {
$wday = $date->format('N');
$tallocations = $this->so_wtemplate_alloc->read(array('filters' => array('season_id' => $season_id, 'wday' => $wday), 'sort' => 'from_'));
foreach ($tallocations['results'] as $talloc) {
$allocation = extract_values($talloc, array('season_id', 'organization_id', 'cost', 'resources', 'organization_name'));
$allocation['active'] = '1';
$allocation['from_'] = $date->format("Y-m-d") . ' ' . $talloc['from_'];
$allocation['to_'] = $date->format("Y-m-d") . ' ' . $talloc['to_'];
$allocation['building_name'] = $season['building_name'];
$allocation['completed'] = 1;
$errors = $this->bo_allocation->validate($allocation);
if (!$errors) {
$valid[] = $allocation;
} elseif (count($this->bo_allocation->filter_conflict_errors($errors)) === 0) {
$invalid[] = $allocation;
} else {
throw new UnexpectedValueException('Encountered an unexpected validation error');
}
}
if ($date->format('N') == 7) {
if ($interval == 2) {
$date->modify('+7 days');
} elseif ($interval == 3) {
$date->modify('+14 days');
} elseif ($interval == 4) {
$date->modify('+21 days');
}
}
$date->modify('+1 day');
if ($date->format('Y-m-d') > $to->format('Y-m-d')) {
if ($write) {
$this->so->db->transaction_begin();
foreach ($valid as $alloc) {
$this->bo_allocation->add($alloc);
}
$this->so->db->transaction_commit();
}
return array('valid' => $valid, 'invalid' => $invalid);
}
} while (true);
}
示例5: extract_values
<?php
require_once 'includes/allspells.php';
require_once 'includes/allreputation.php';
$smarty->config_load($conf_file, 'spell');
@(list($s1, $s2, $s3) = extract_values($podrazdel));
$cache_key = cache_key($s1, $s2, $s3);
if (!($spells = load_cache(SPELL_LISTING, $cache_key))) {
unset($spells);
$spells = array();
if ($s1 == 7) {
// Классовые
$title = $smarty->get_config_vars('Class_spells');
$rows = $DB->select('
SELECT ?#, s.`spellID`, sla.skillID
FROM ?_spell s, ?_skill_line_ability sla, ?_spellicons i
WHERE
s.spellID = sla.spellID
AND s.levelspell > 0
AND i.id=s.spellicon
{AND sla.classmask & ?d}
{AND sla.skillID=?d}
ORDER BY s.levelspell
{LIMIT ?d}
', $spell_cols[2], isset($s2) ? pow(2, $s2 - 1) : DBSIMPLE_SKIP, isset($s3) ? $s3 : DBSIMPLE_SKIP, $AoWoWconf['limit'] != 0 ? $AoWoWconf['limit'] : DBSIMPLE_SKIP);
} elseif ($s1 > 0) {
switch ($s1) {
case 6:
$title = $smarty->get_config_vars('Weapon_spells');
break;
case 8:
示例6: extract_form_data
protected function extract_form_data($defaults = array())
{
$organization = array_merge($defaults, extract_values($_POST, $this->fields));
$this->extract_customer_identifier($organization);
return $organization;
}
示例7: edit
public function edit()
{
$id = intval(phpgw::get_var('id', 'GET'));
$building = $this->bo->read_single($id);
$building['id'] = $id;
$building['buildings_link'] = self::link(array('menuaction' => 'booking.uibuilding.index'));
$building['cancel_link'] = self::link(array('menuaction' => 'booking.uibuilding.show', 'id' => $building['id']));
$building['top-nav-bar-buildings'] = lang('Buildings');
$config = CreateObject('phpgwapi.config', 'booking');
$config->read();
if ($config->config_data['extra_schedule'] == 'yes') {
$building['extra'] = 1;
} else {
$building['extra'] = 0;
}
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$building = array_merge($building, extract_values($_POST, $this->fields));
$errors = $this->bo->validate($building);
if (!$errors) {
$receipt = $this->bo->update($building);
$this->redirect(array('menuaction' => 'booking.uibuilding.show', 'id' => $receipt['id']));
}
}
$this->flash_form_errors($errors);
$this->use_yui_editor();
self::render_template('building_form', array('building' => $building));
}
示例8: check_active
public function check_active($url)
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$activate = extract_values($_POST, array("status", "activate_id"));
$this->bo->set_active(intval($activate['activate_id']), intval($activate['status']));
$this->redirect(array('menuaction' => $url, 'id' => $activate['activate_id']));
}
}
示例9: extract_form_data
protected function extract_form_data($defaults = array())
{
$entity = array_merge($defaults, extract_values($_POST, $this->fields));
$this->agegroup_bo->extract_form_data($entity);
$this->extract_customer_identifier($entity);
return $entity;
}
示例10: edit
public function edit()
{
$id = intval(phpgw::get_var('id', 'GET'));
$document = $this->bo->read_single($id);
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$document = array_merge($document, extract_values($_POST, $this->fields));
$errors = $this->bo->validate($document);
if (!$errors) {
$receipt = $this->bo->update($document);
$this->redirect('booking.uidocumentation.index');
}
}
self::add_javascript('booking', 'booking', 'document.js');
$this->flash_form_errors($errors);
$this->add_default_display_data($document);
self::render_template('documentation_form', array('document' => $document));
}
示例11: edit
public function edit()
{
$id = intval(phpgw::get_var('id', 'GET'));
$activity = $this->bo->read_single($id);
$parent_activity = $this->bo->read_single($activity['parent_id']);
$activities = $this->bo->fetch_activities();
$activities = $activities['results'];
$activity['id'] = $id;
$activity['activities_link'] = self::link(array('menuaction' => 'booking.uiactivity.index'));
$activity['building_link'] = self::link(array('menuaction' => 'booking.uibuilding.index'));
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['parent_id'] == '0') {
$_POST['parent_id'] = null;
}
$activity = array_merge($activity, extract_values($_POST, array('name', 'active', 'description', 'parent_id')));
$errors = $this->bo->validate($activity);
if (!$errors) {
$receipt = $this->bo->update($activity);
$this->redirect(array('menuaction' => 'booking.uiactivity.index'));
}
}
$this->flash_form_errors($errors);
$activity['cancel_link'] = self::link(array('menuaction' => 'booking.uiactivity.index'));
self::render_template('activity_edit', array('activity' => $activity, 'parent' => $parent_activity, 'activities' => $activities));
}
示例12: extract_values
<?php
// Необходима функция iteminfo
require_once 'includes/allitems.php';
$smarty->config_load($conf_file, 'items');
// Разделяем из запроса класс, подкласс и тип вещей
@(list($class, $subclass, $type) = extract_values($podrazdel));
$cache_key = cache_key($class, $subclass, $type);
if (!($items = load_cache(7, $cache_key))) {
unset($items);
// Составляем запрос к БД, выполняющий поиск по заданным классу и подклассу
$rows = $DB->select('
SELECT ?#, i.entry, maxcount
{, l.name_loc?d AS name_loc}
FROM ?_icons, item_template i
{LEFT JOIN (locales_item l) ON l.entry=i.entry AND ?d}
WHERE
id=displayid
{ AND class = ? }
{ AND subclass = ? }
{ AND InventoryType = ? }
ORDER BY quality DESC, name
{ LIMIT ?d }
', $item_cols[2], $_SESSION['locale'] ? $_SESSION['locale'] : DBSIMPLE_SKIP, $_SESSION['locale'] ? 1 : DBSIMPLE_SKIP, isset($class) ? $class : DBSIMPLE_SKIP, isset($subclass) ? $subclass : DBSIMPLE_SKIP, isset($type) ? $type : DBSIMPLE_SKIP, $AoWoWconf['limit'] != 0 ? $AoWoWconf['limit'] : DBSIMPLE_SKIP);
$items = array();
foreach ($rows as $row) {
$items[] = iteminfo2($row);
}
save_cache(7, $cache_key, $items);
}
global $page;
示例13: edit
public function edit()
{
$id = intval(phpgw::get_var('id', 'GET'));
$audience = $this->bo->read_single($id);
$audience['id'] = $id;
$audience['resource_link'] = self::link(array('menuaction' => 'booking.uiaudience.show', 'id' => $audience['id']));
$audience['resources_link'] = self::link(array('menuaction' => 'booking.uiresource.index'));
$audience['audience_link'] = self::link(array('menuaction' => 'booking.uiaudience.index'));
$audience['building_link'] = self::link(array('menuaction' => 'booking.uibuilding.index'));
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$audience = array_merge($audience, extract_values($_POST, array('name', 'sort', 'description', 'active')));
$errors = $this->bo->validate($audience);
if (!$errors) {
$audience = $this->bo->update($audience);
$this->redirect(array('menuaction' => 'booking.uiaudience.index', 'id' => $audience['id']));
}
}
$this->flash_form_errors($errors);
$audience['cancel_link'] = self::link(array('menuaction' => 'booking.uiaudience.index'));
self::render_template('audience_edit', array('audience' => $audience));
}
示例14: edit
public function edit()
{
$id = intval(phpgw::get_var('id', 'GET'));
if ($id) {
$group = $this->bo->read_single($id);
$group['id'] = $id;
$group['organization_link'] = $this->link_to('show', array('ui' => 'organization', 'id' => $group['organization_id']));
$group['cancel_link'] = $this->link_to('show', array('id' => $id));
if ($this->is_inline()) {
$group['cancel_link'] = $this->link_to_parent();
}
} else {
$group = array();
$group['cancel_link'] = $this->link_to('index', array('ui' => 'organization'));
if ($this->is_inline()) {
$group['organization_link'] = $this->link_to_parent();
$group['cancel_link'] = $this->link_to_parent();
$this->apply_inline_params($group);
}
}
$group['organizations_link'] = $this->link_to('index', array('ui' => 'organization'));
$errors = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$group = array_merge($group, extract_values($_POST, array('name' => 'string', 'shortname' => 'string', 'organization_id' => 'string', 'organization_name' => 'string', 'description' => 'html', 'contacts' => 'string', 'active' => 'int', 'activity_id' => 'int', 'show_in_portal' => 'int')));
if (!isset($group["active"])) {
$group['active'] = '1';
}
$errors = $this->bo->validate($group);
if (strlen($_POST['name']) > 50) {
$errors['name'] = lang('Lengt of name is to long, max 50 characters long');
}
if (strlen($_POST['shortname']) > 11) {
$errors['shortname'] = lang('Lengt of shortname is to long, max 11 characters long');
}
if (!$errors) {
if ($id) {
$receipt = $this->bo->update($group);
} else {
$receipt = $this->bo->add($group);
}
$this->redirect_to_parent_if_inline();
$this->redirect($this->link_to_params('show', array('id' => $receipt['id'])));
}
}
$this->flash_form_errors($errors);
if (is_array($parent_entity = $this->get_parent_if_inline())) {
$group[$this->get_current_parent_type() . '_id'] = $parent_entity['id'];
$group[$this->get_current_parent_type() . '_name'] = $parent_entity['name'];
}
$this->use_yui_editor();
$activities = $this->activity_bo->fetch_activities();
$activities = $activities['results'];
self::render_template('group_edit', array('group' => $group, 'module' => $this->module, 'activities' => $activities));
}
示例15: add
public function add()
{
$errors = array();
$permission = array();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$permission = extract_values($_POST, $this->fields);
$errors = $this->bo->validate($permission);
if (!$errors) {
$receipt = $this->bo->add($permission);
$this->redirect($this->generate_link_params('index'));
}
}
self::add_javascript('booking', 'booking', 'permission_root.js');
$this->add_default_display_data($permission);
$this->flash_form_errors($errors);
self::render_template('permission_root_form', array('permission' => $permission));
}