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


PHP phpgw::clean_value方法代码示例

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


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

示例1: index

 /**
  * @param mixed $data
  * If $data is an array - then the process is run as cron - and will look for $data['function'] to
  * determine which custom class to load
  */
 function index($data = '')
 {
     if (!isset($GLOBALS['phpgw_info']['user']['apps']['admin'])) {
         return;
     }
     if (is_array($data)) {
         $function = $data['function'];
     } else {
         $data = unserialize(urldecode(phpgw::get_var('data')));
         $data = phpgw::clean_value($data);
         if (!isset($data['function'])) {
             $function = phpgw::get_var('function');
         } else {
             $function = $data['function'];
         }
     }
     // prevent path traversal
     if (preg_match('/\\.\\./', $function)) {
         return;
     }
     $file = PHPGW_SERVER_ROOT . "/property/inc/cron/{$GLOBALS['phpgw_info']['user']['domain']}/{$function}.php";
     if (is_file($file)) {
         require_once $file;
         $custom = new $function();
         $custom->pre_run($data);
     } else {
         echo "no such file: path_to_phpgw_server_root/property/inc/cron/{$GLOBALS['phpgw_info']['user']['domain']}/{$function}.php";
     }
 }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:34,代码来源:class.custom_functions.inc.php

示例2: extract_values

/**
 * Cherry pick selected values into a new array
 * 
 * @param array $array    input array
 * @param array $keys     array of keys to pick
 *
 * @return array containg values from $array for the keys in $keys.
 */
function extract_values($array, $keys)
{
    $result = array();
    foreach ($keys as $key) {
        if (in_array($key, array_keys($array))) {
            $result[$key] = phpgw::clean_value($array[$key]);
        }
    }
    return $result;
}
开发者ID:HaakonME,项目名称:porticoestate,代码行数:18,代码来源:class.uicommon.inc.php

示例3: index

 public function index()
 {
     $config = CreateObject('phpgwapi.config', 'booking');
     $config->read();
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         foreach ($_POST as $dim => $value) {
             if (strlen(trim($value)) > 0) {
                 $config->value($dim, phpgw::clean_value($value));
             } else {
                 unset($config->config_data[$dim]);
             }
         }
         $config->save_repository();
     }
     $this->use_yui_editor();
     self::render_template('metasettings', array('config_data' => $config->config_data));
 }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:17,代码来源:class.uimetasettings.inc.php

示例4: responsiblility_role

 function responsiblility_role()
 {
     $type_id = phpgw::get_var('type_id', 'int');
     $dry_run = false;
     if (!$type_id) {
         $type_id = 1;
     }
     if ($_menu_selection = phpgw::get_var('menu_selection')) {
         $GLOBALS['phpgw_info']['flags']['menu_selection'] = $_menu_selection;
     } else {
         $GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::responsibility_role';
     }
     if (!$this->acl_read) {
         $this->bocommon->no_access();
         return;
     }
     $values = phpgw::get_var('values');
     $values_assign = $_POST['values_assign'];
     $role_id = phpgw::get_var('role_id', 'int');
     $receipt = array();
     //	$_role = CreateObject('property.sogeneric');
     //	$_role->get_location_info('responsibility_role','');
     $this->save_sessiondata();
     $user_id = phpgw::get_var('user_id', 'int', 'request', $this->account);
     if ($values_assign && $this->acl_edit) {
         $values_assign = phpgw::clean_value(json_decode(stripslashes($values_assign), true));
         //json_decode has issues with magic_quotes_gpc
         $user_id = abs($user_id);
         $account = $GLOBALS['phpgw']->accounts->get($user_id);
         $contact_id = $account->person_id;
         if (!$role_id) {
             $receipt['error'][] = array('msg' => lang('missing role'));
         } else {
             //		$role = $_role->read_single($data=array('id' => $role_id));
             $values['contact_id'] = $contact_id;
             //		$values['responsibility_id']	= $role['responsibility_id'];
             $values['responsibility_role_id'] = $role_id;
             $values['assign'] = $values_assign['assign'];
             $values['assign_orig'] = $values_assign['assign_orig'];
             $boresponsible = CreateObject('property.boresponsible');
             $receipt = $boresponsible->update_role_assignment($values);
         }
     }
     $second_display = phpgw::get_var('second_display', 'bool');
     $default_district = isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district']) ? $GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'] : '';
     if ($default_district && !$second_display && !$this->district_id) {
         $this->bo->district_id = $default_district;
         $this->district_id = $default_district;
     }
     $datatable = array();
     $values_combo_box = array();
     if (phpgw::get_var('phpgw_return_as') != 'json') {
         $datatable['config']['base_url'] = $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'property.uilocation.responsiblility_role', 'type_id' => $type_id, 'query' => $this->query, 'district_id' => $this->district_id, 'part_of_town_id' => $this->part_of_town_id, 'lookup' => $lookup, 'lookup_tenant' => $lookup_tenant, 'lookup_name' => $lookup_name, 'cat_id' => $this->cat_id, 'status' => $this->status, 'location_code' => $this->location_code, 'menu_selection' => $_menu_selection, 'download_type' => 'responsiblility_role'));
         $datatable['config']['allow_allrows'] = true;
         $datatable['config']['base_java_url'] = "menuaction:'property.uilocation.responsiblility_role'," . "type_id:'{$type_id}'," . "query:'{$this->query}'," . "district_id: '{$this->district_id}'," . "part_of_town_id:'{$this->part_of_town_id}'," . "lookup:'{$lookup}'," . "second_display:1," . "lookup_tenant:'{$lookup_tenant}'," . "lookup_name:'{$lookup_name}'," . "cat_id:'{$this->cat_id}'," . "status:'{$this->status}'," . "location_code:'{$this->location_code}'," . "block_query:'{$block_query}'," . "menu_selection:'{$_menu_selection}'," . "download_type:'responsiblility_role'";
         $values_combo_box[0] = execMethod('property.soadmin_location.read', array());
         //$values_combo_box[0]  = array(array('id'=>'1','name'=> 'Eiendom'));
         $values_combo_box[1] = $this->bocommon->select_category_list(array('format' => 'filter', 'selected' => $this->cat_id, 'type' => 'location', 'type_id' => $type_id, 'order' => 'descr'));
         $default_value = array('id' => '', 'name' => lang('no category'));
         array_unshift($values_combo_box[1], $default_value);
         $values_combo_box[2] = $this->bocommon->select_district_list('filter', $this->district_id);
         $default_value = array('id' => '', 'name' => lang('no district'));
         array_unshift($values_combo_box[2], $default_value);
         $values_combo_box[3] = $this->bocommon->select_part_of_town('filter', $this->part_of_town_id, $this->district_id);
         $default_value = array('id' => '', 'name' => lang('no part of town'));
         array_unshift($values_combo_box[3], $default_value);
         /*
         				$_role_criteria = array
         				(
         					'allrows'	=> true,
         					'order'		=> 'name'
         				);
         
         
         				$roles = $_role->read($_role_criteria);
         				foreach ($roles as $role)
         				{
         					if(ctype_digit(ltrim($role['location'],'.location')))
         					{
         						 $values_combo_box[5][] = array
         						 (
         							'id'		=> $role['id'],
         							'name'		=> $role['name'],
         							'type_id'	=> ltrim($role['location'],'.location')
         						 );
         					}
         				}
         
         				$default_value = array ('id'=>'','name'=>lang('no role'));
         				array_unshift ($values_combo_box[5],$default_value);
         */
         $_role_criteria = array('type' => 'responsibility_role', 'filter' => array('location_level' => $type_id), 'filter_method' => 'like', 'order' => 'name');
         $values_combo_box[4] = execMethod('property.sogeneric.get_list', $_role_criteria);
         foreach ($values_combo_box[4] as &$_role) {
             $_role['name'] .= ':: ' . execMethod('property.soresponsible.get_responsibility_name_from_role', $_role['id']);
         }
         $default_value = array('id' => '', 'name' => lang('no role'));
         array_unshift($values_combo_box[4], $default_value);
         //				$values_combo_box[5]  = $this->bocommon->get_user_list_right2('filter',PHPGW_ACL_READ,$this->user_id,".location.{$type_id}");
         $_users = $GLOBALS['phpgw']->accounts->get_list('accounts', -1, 'ASC', 'account_lastname', '', -1);
//.........这里部分代码省略.........
开发者ID:HaakonME,项目名称:porticoestate,代码行数:101,代码来源:class.uilocation.inc.php

示例5: _populate

 private function _populate($data = array())
 {
     $insert_record = phpgwapi_cache::session_get('property', 'insert_record');
     $values = phpgw::get_var('values');
     $_fields = array(array('name' => 'title', 'type' => 'string', 'required' => true), array('name' => 'descr', 'type' => 'string', 'required' => true), array('name' => 'cat_id', 'type' => 'integer', 'required' => true), array('name' => 'report_date', 'type' => 'string', 'required' => true), array('name' => 'status_id', 'type' => 'integer', 'required' => true), array('name' => 'vendor_id', 'type' => 'integer', 'required' => false), array('name' => 'vendor_name', 'type' => 'string', 'required' => false), array('name' => 'coordinator_id', 'type' => 'integer', 'required' => false), array('name' => 'coordinator_name', 'type' => 'string', 'required' => false), array('name' => 'multiplier', 'type' => 'float', 'required' => false));
     foreach ($_fields as $_field) {
         if ($data[$_field['name']] = $_POST['values'][$_field['name']]) {
             $data[$_field['name']] = phpgw::clean_value($data[$_field['name']], $_field['type']);
         }
         if ($_field['required'] && !$data[$_field['name']]) {
             $this->receipt['error'][] = array('msg' => lang('Please enter value for attribute %1', $_field['name']));
         }
     }
     //_debug_array($data);die();
     $values = $this->bocommon->collect_locationdata($data, $insert_record);
     if (!isset($values['location_code']) || !$values['location_code']) {
         $this->receipt['error'][] = array('msg' => lang('Please select a location !'));
     }
     /*
      * Extra data from custom fields
      */
     $values['attributes'] = phpgw::get_var('values_attribute');
     if (is_array($values['attributes'])) {
         foreach ($values['attributes'] as $attribute) {
             if ($attribute['nullable'] != 1 && (!$attribute['value'] && !$values['extra'][$attribute['name']])) {
                 $this->receipt['error'][] = array('msg' => lang('Please enter value for attribute %1', $attribute['input_text']));
             }
         }
     }
     if (!isset($values['cat_id']) || !$values['cat_id']) {
         $this->receipt['error'][] = array('msg' => lang('Please select a category !'));
     }
     if (!isset($values['title']) || !$values['title']) {
         $this->receipt['error'][] = array('msg' => lang('Please give a title !'));
     }
     if (!isset($values['report_date']) || !$values['report_date']) {
         $this->receipt['error'][] = array('msg' => lang('Please select a date!'));
     }
     return $values;
 }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:40,代码来源:class.uicondition_survey.inc.php

示例6: export_cron

 function export_cron($data = array())
 {
     if (!$data) {
         $data = unserialize(urldecode(phpgw::get_var('data')));
         $data = phpgw::clean_value($data);
     }
     _debug_array($data);
     $receipt = $this->export($data);
     _debug_array($receipt);
 }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:10,代码来源:class.boXport.inc.php

示例7: header

     if (phpgw::get_var('phpgw_return_as', 'string') == 'json') {
         header('Content-Type: application/json');
         echo json_encode(array('sessionExpired' => true));
         $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
         $GLOBALS['phpgw']->common->phpgw_exit();
     } else {
         $GLOBALS['phpgw']->redirect_link('/login.php', $cd_array);
     }
 }
 if (isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) && $GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] != $GLOBALS['phpgw_info']['server']['default_lang']) {
     $GLOBALS['phpgw']->translation->set_userlang($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'], true);
 }
 $redirect = unserialize(phpgw::get_var('redirect', 'raw', 'COOKIE'));
 if (is_array($redirect) && count($redirect)) {
     foreach ($redirect as $key => $value) {
         $redirect_data[$key] = phpgw::clean_value($value);
     }
     $sessid = phpgw::get_var('sessionid', 'string', 'GET');
     if ($sessid) {
         $redirect_data['sessionid'] = $sessid;
         $redirect_data['kp3'] = phpgw::get_var('kp3', 'string', 'GET');
     }
     $GLOBALS['phpgw']->session->phpgw_setcookie('redirect', false, 0);
     $GLOBALS['phpgw']->redirect_link('/index.php', $redirect_data);
     unset($redirect);
     unset($redirect_data);
     unset($sessid);
 }
 /* A few hacker resistant constants that will be used throught the program */
 define('PHPGW_TEMPLATE_DIR', ExecMethod('phpgwapi.phpgw.common.get_tpl_dir', 'phpgwapi'));
 define('PHPGW_IMAGES_DIR', ExecMethod('phpgwapi.phpgw.common.get_image_path', 'phpgwapi'));
开发者ID:HaakonME,项目名称:porticoestate,代码行数:31,代码来源:functions.inc.php

示例8: unset

        unset($_COOKIE['last_usertype']);
    }
}
$last_loginid = phpgw::get_var('last_loginid', 'string', 'COOKIE');
if ($GLOBALS['phpgw_info']['server']['show_domain_selectbox'] && $last_loginid !== '') {
    reset($GLOBALS['phpgw_domain']);
    list($default_domain) = each($GLOBALS['phpgw_domain']);
    if ($_COOKIE['last_domain'] != $default_domain && !empty($_COOKIE['last_domain'])) {
        $last_loginid .= '@' . phpgw::get_var('last_domain', 'string', 'COOKIE');
    }
}
//FIXME switch to an array
$extra_vars = array();
foreach ($_GET as $name => $value) {
    if (preg_match('/phpgw_/', $name)) {
        $extra_vars[$name] = urlencode(phpgw::clean_value($value));
    }
}
$cd = 0;
if (isset($_GET['cd'])) {
    $cd = (int) $_GET['cd'];
}
$tmpl->set_var('login_url', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/property/login.php?' . http_build_query($extra_vars));
$tmpl->set_var('registration_url', $GLOBALS['phpgw_info']['server']['webserver_url'] . '/registration/');
$tmpl->set_var('version', $GLOBALS['phpgw_info']['server']['versions']['phpgwapi']);
$tmpl->set_var('cd', check_logoutcode($cd));
$tmpl->set_var('last_loginid', $last_loginid);
$tmpl->set_var('lang_username', lang('username'));
$tmpl->set_var('lang_password', lang('password'));
$tmpl->set_var('lang_login', lang('login'));
$tmpl->set_var('lang_testjs', lang('Your browser does not support javascript and/or css, please use a modern standards compliant browser.  If you have disabled either of these features please enable them for this site.'));
开发者ID:HaakonME,项目名称:porticoestate,代码行数:31,代码来源:login.php

示例9: prepare_for_db

    function prepare_for_db($table, $values_attribute, $id = 0)
    {
        $id = (int) $id;
        $data = array();
        if (isset($values_attribute) && is_array($values_attribute)) {
            foreach ($values_attribute as $entry) {
                if ($entry['disabled']) {
                    continue;
                }
                switch ($entry['datatype']) {
                    case 'C':
                    case 'T':
                    case 'V':
                    case 'link':
                    case 'email':
                    case 'link':
                        $data['value_set'][$entry['name']] = isset($entry['value']) && $entry['value'] ? $this->_db2->db_addslashes(phpgw::clean_value($entry['value'], 'string')) : '';
                        $entry['value'] = $this->_db2->db_addslashes($entry['value']);
                        // in case of history entries
                        break;
                    case 'LB':
                    case 'R':
                    case 'AB':
                    case 'ABO':
                    case 'AB':
                    case 'ABO':
                    case 'VENDOR':
                    case 'event':
                    case 'I':
                    case 'custom3':
                    case 'user':
                        $data['value_set'][$entry['name']] = isset($entry['value']) && $entry['value'] ? phpgw::clean_value($entry['value'], 'int') : '';
                        break;
                    case 'bolean':
                        $data['value_set'][$entry['name']] = isset($entry['value']) && $entry['value'] ? phpgw::clean_value($entry['value'], 'bool') : '';
                        break;
                    case 'N':
                        $data['value_set'][$entry['name']] = isset($entry['value']) && $entry['value'] ? phpgw::clean_value($entry['value'], 'float') : '';
                        break;
                    case 'CH':
                        $_value = ',' . implode(',', phpgw::clean_value($entry['value'])) . ',';
                        $data['value_set'][$entry['name']] = isset($entry['value']) && $entry['value'] ? $_value : '';
                        break;
                    case 'D':
                    case 'DT':
                        $data['value_set'][$entry['name']] = isset($entry['value']) && $entry['value'] ? $entry['value'] : '';
                        break;
                    case 'pwd':
                        if ($entry['value'] && $entry['value2']) {
                            if ($entry['value'] || $entry['value2']) {
                                if ($entry['value'] == $entry['value2']) {
                                    $data['value_set'][$entry['name']] = md5($entry['value']);
                                } else {
                                    throw new Exception(lang('Passwords do not match!'));
                                }
                            }
                        } else {
                            $data['value_set'][$entry['name']] = isset($entry['value']) ? $entry['value'] : '';
                        }
                        break;
                    default:
                        $data['value_set'][$entry['name']] = isset($entry['value']) && $entry['value'] ? $this->_db2->db_addslashes(phpgw::clean_value($entry['value'], 'string')) : '';
                }
                if ($entry['history'] == 1) {
                    if ($id) {
                        $this->_db2->query("SELECT {$entry['name']} FROM {$table} WHERE id = {$id}", __LINE__, __FILE__);
                        $this->_db2->next_record();
                        $old_value = $this->_db2->f($entry['name']);
                        if ($entry['value'] != $old_value) {
                            $data['history_set'][$entry['attrib_id']] = array('
									value' => $entry['value'], 'date' => phpgwapi_datetime::date_to_timestamp($entry['date']));
                        }
                    } else {
                        $data['history_set'][$entry['attrib_id']] = $entry['value'];
                    }
                }
            }
        }
        return $data;
    }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:80,代码来源:class.custom_fields.inc.php

示例10: prizing

 function prizing()
 {
     if (!$this->acl_manage) {
         $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 'property.uilocation.stop', 'perm' => 16, 'acl_location' => $this->acl_location));
     }
     $GLOBALS['phpgw']->xslttpl->add_file(array('pricebook', 'nextmatchs', 'search_field'));
     $cat_id = phpgw::get_var('cat_id', 'int', 'GET');
     $activity_id = phpgw::get_var('activity_id', 'int');
     $vendor_id = phpgw::get_var('vendor_id', 'int', 'GET');
     $agreement_id = phpgw::get_var('agreement_id', 'int', 'GET');
     $values = phpgw::get_var('values');
     $referer = $GLOBALS['phpgw']->session->appsession('referer', 'property');
     if (!$referer) {
         $referer = phpgw::get_var('HTTP_REFERER', 'string', 'SERVER', phpgw::clean_value($GLOBALS['HTTP_REFERER']));
         $referer .= '&cat_id=' . $cat_id;
         $GLOBALS['phpgw']->session->appsession('referer', 'property', $referer);
     }
     if ($values['submit_update']) {
         if (!$values['date']) {
             $receipt['error'][] = array('msg' => lang('Please select a date !'));
         }
         if (!$values['new_index']) {
             $receipt['error'][] = array('msg' => lang('Please enter a new index for calculating next value(s)!'));
         }
         if (!$receipt['error']) {
             $receipt = $this->bo->update_pricebook($values);
         }
     }
     if ($values['submit_add']) {
         if (!$values['date']) {
             $receipt['error'][] = array('msg' => lang('Please select a date !'));
         }
         if (!$values['m_cost'] && !$values['w_cost']) {
             $receipt['error'][] = array('msg' => lang('Please enter a value for either material cost, labour cost or both !'));
         }
         if (!$receipt['error']) {
             $receipt = $this->bo->add_activity_first_prize($values);
         }
     }
     $pricebook_list = $this->bo->read_activity_prize($activity_id, $agreement_id);
     $dateformat = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
     if (isset($pricebook_list) and is_array($pricebook_list)) {
         foreach ($pricebook_list as $pricebook) {
             if ($pricebook['current_index']) {
                 $link_delete = $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'property.uipricebook.delete', 'method' => 'prize', 'activity_id' => $activity_id, 'agreement_id' => $agreement_id, 'index_count' => $pricebook['index_count']));
                 $value_m_cost = $pricebook['m_cost'];
                 $value_w_cost = $pricebook['w_cost'];
                 $value_total_cost = $pricebook['total_cost'];
             }
             $content[] = array('m_cost' => $pricebook['m_cost'], 'w_cost' => $pricebook['w_cost'], 'total_cost' => $pricebook['total_cost'], 'this_index' => $pricebook['this_index'], 'date' => $GLOBALS['phpgw']->common->show_date($pricebook['date'], $dateformat), 'current_index' => $pricebook['current_index'], 'index_count' => $pricebook['index_count'], 'link_delete' => $link_delete, 'lang_delete_statustext' => lang('Delete this entry'), 'text_delete' => lang('delete'));
         }
     }
     //_debug_array($content);
     $table_header[] = array('lang_index_count' => lang('Index Count'), 'lang_total_cost' => lang('Total Cost'), 'lang_prizing' => lang('Prizing'), 'lang_last_index' => lang('Last index'), 'lang_m_cost' => lang('Material cost'), 'lang_w_cost' => lang('Labour cost'), 'lang_date' => lang('Date'), 'lang_delete' => lang('Delete'));
     $GLOBALS['phpgw']->jqcal->add_listener('values_date');
     $table_update[] = array('lang_new_index' => lang('New index'), 'lang_new_index_statustext' => lang('Enter a new index'), 'lang_date_statustext' => lang('Select the date for the update'), 'lang_update' => lang('Update'), 'lang_update_statustext' => lang('update selected investments'));
     $table_first_entry[] = array('lang_m_cost' => lang('Material cost'), 'lang_m_cost_statustext' => lang('Enter a value for the material cost'), 'lang_w_cost' => lang('Labour cost'), 'lang_w_cost_statustext' => lang('Enter a value for the labour cost'), 'lang_date' => lang('Date'), 'lang_date_statustext' => lang('Select the date for the first value'), 'lang_add' => lang('Add'), 'lang_add_statustext' => lang('Add first value for this prizing'));
     $link_data = array('menuaction' => 'property.uipricebook.prizing', 'activity_id' => $activity_id, 'agreement_id' => $agreement_id);
     if (!$this->allrows) {
         $record_limit = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
     } else {
         $record_limit = $this->bo->total_records;
     }
     $num_records = count($pricebook_list);
     $vendor_data = $this->contacts->read_single(array('id' => $vendor_id), array('attributes' => array(array('column_name' => 'org_name'))));
     if (is_array($vendor_data)) {
         foreach ($vendor_data['attributes'] as $attribute) {
             if ($attribute['name'] == 'org_name') {
                 $value_vendor_name = $attribute['value'];
                 break;
             }
         }
     }
     $activity = $this->bo->read_single_activity($activity_id);
     $msgbox_data = $this->bocommon->msgbox_data($receipt);
     $data = array('msgbox_data' => $GLOBALS['phpgw']->common->msgbox($msgbox_data), 'done_action' => $referer, 'lang_done' => lang('done'), 'lang_done_statustext' => lang('Back to the list'), 'allrows' => $this->allrows, 'allow_allrows' => true, 'start_record' => $this->start, 'record_limit' => $record_limit, 'num_records' => $num_records, 'all_records' => $this->bo->total_records, 'link_url' => $GLOBALS['phpgw']->link('/index.php', $link_data), 'img_path' => $GLOBALS['phpgw']->common->get_image_path('phpgwapi', 'default'), 'lang_vendor' => lang('Vendor'), 'lang_activity' => lang('Activity'), 'value_vendor_name' => $value_vendor_name, 'value_activity_id' => $activity_id, 'value_activity_code' => $activity['num'], 'value_vendor_id' => $vendor_id, 'value_m_cost' => $value_m_cost, 'value_w_cost' => $value_w_cost, 'value_total_cost' => $value_total_cost, 'table_header_prizing' => $table_header, 'values_prizing' => $content, 'table_update' => $table_update, 'table_first_entry' => $table_first_entry, 'update_action' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'property.uipricebook.prizing', 'activity_id' => $activity_id, 'vendor_id' => $vendor_id)));
     $appname = lang('pricebook');
     $function_msg = lang('edit pricing');
     $GLOBALS['phpgw_info']['flags']['app_header'] = lang('property') . ' - ' . $appname . ': ' . $function_msg;
     $GLOBALS['phpgw']->xslttpl->set_var('phpgw', array('prizing' => $data));
     //	$GLOBALS['phpgw']->xslttpl->pp();
     $this->save_sessiondata();
 }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:83,代码来源:class.uipricebook.inc.php

示例11: import


//.........这里部分代码省略.........
     $import_type_responsibility[1] = 1;
     //hidden => responsible_unit 1
     $import_type_responsibility[2] = 1;
     //'Normal import' => responsible_unit 1
     $import_type_responsibility[3] = 2;
     //'Customers' => responsible_unit 2
     $import_type_responsibility[4] = 3;
     //'Customers' => responsible_unit 3
     $import_type_responsibility[5] = 4;
     //'Customers' => responsible_unit 3
     $import_type_responsibility[6] = 5;
     //'Customers' => responsible_unit 3
     $import_type_responsibility[7] = 6;
     //'Customers' => responsible_unit 3
     $import_type_responsibility[8] = 7;
     //'Customers' => responsible_unit 3
     /*
     		$cats_candidates = array
     		(
     			1 => 'Investment',
     			2 => 'Operation',
     			3 => 'Combined::Investment/Operation',
     		);
     */
     $_update_buildingpart = array();
     $filter_buildingpart = isset($config->config_data['filter_buildingpart']) ? $config->config_data['filter_buildingpart'] : array();
     if ($filter_key = array_search('.project.request', $filter_buildingpart)) {
         $_update_buildingpart = array("filter_{$filter_key}" => 1);
     }
     foreach ($import_data as &$entry) {
         $entry['amount_investment'] = (int) str_replace(array(' ', ','), array('', '.'), $entry['amount_investment']);
         $entry['amount_operation'] = (int) str_replace(array(' ', ','), array('', '.'), $entry['amount_operation']);
         $entry['amount_potential_grants'] = (int) str_replace(array(' ', ','), array('', '.'), $entry['amount_potential_grants']);
         $entry['import_type'] = (int) $entry['import_type'];
         $entry['condition_degree'] = (int) $entry['condition_degree'];
         $entry['amount'] = $entry['amount_investment'] + $entry['amount_operation'] + $entry['amount_potential_grants'];
     }
     unset($entry);
     $custom = createObject('phpgwapi.custom_fields');
     $attributes = $custom->find('property', '.project.request', 0, '', '', '', true, true);
     $origin_id = $GLOBALS['phpgw']->locations->get_id('property', '.project.condition_survey');
     foreach ($import_data as $entry) {
         //if( $entry['condition_degree'] > 0 && $entry['building_part'] && $entry['import_type'] > 0)
         if ($entry['amount'] && $entry['building_part'] && $entry['import_type'] > 0) {
             $request = array();
             if ($entry['amount_investment'] && !$entry['amount_operation']) {
                 if (isset($config->config_data['condition_survey_import_cat'][1])) {
                     $request['cat_id'] = (int) $config->config_data['condition_survey_import_cat'][1];
                 }
             }
             if (!$entry['amount_investment'] && $entry['amount_operation']) {
                 if (isset($config->config_data['condition_survey_import_cat'][2])) {
                     $request['cat_id'] = (int) $config->config_data['condition_survey_import_cat'][2];
                 }
             } else {
                 if (isset($config->config_data['condition_survey_import_cat'][3])) {
                     $request['cat_id'] = (int) $config->config_data['condition_survey_import_cat'][3];
                 }
             }
             if (!isset($request['cat_id']) || !$request['cat_id']) {
                 $request['cat_id'] = (int) $categories[0]['id'];
             }
             $this->_check_building_part($entry['building_part'], $_update_buildingpart);
             $request['condition_survey_id'] = $survey['id'];
             $request['multiplier'] = $survey['multiplier'];
             $request['street_name'] = $location_data['street_name'];
             $request['street_number'] = $location_data['street_number'];
             $request['location'] = $location;
             $request['location_code'] = $survey['location_code'];
             $request['origin_id'] = $origin_id;
             $request['origin_item_id'] = (int) $survey['id'];
             $request['title'] = substr($entry['title'], 0, 255);
             $request['descr'] = phpgw::clean_value($entry['descr'], 'string');
             $request['building_part'] = phpgw::clean_value($entry['building_part'], 'string');
             $request['coordinator'] = $survey['coordinator_id'];
             if ($entry['import_type'] == 1) {
                 $request['status'] = $config->config_data['condition_survey_hidden_status'];
             } else {
                 $request['status'] = $config->config_data['condition_survey_initial_status'];
             }
             $request['amount_investment'] = $entry['amount_investment'];
             $request['amount_operation'] = $entry['amount_operation'];
             $request['amount_potential_grants'] = $entry['amount_potential_grants'];
             $request['planning_value'] = $entry['amount'];
             $request['planning_date'] = mktime(13, 0, 0, 7, 1, $entry['due_year'] ? (int) $entry['due_year'] : date('Y'));
             $request['recommended_year'] = $entry['due_year'] ? (int) $entry['due_year'] : date('Y');
             $request['responsible_unit'] = (int) $import_type_responsibility[$entry['import_type']];
             $request['condition'] = array(array('degree' => $entry['condition_degree'], 'condition_type' => $entry['condition_type'], 'consequence' => $entry['consequence'], 'probability' => $entry['probability']));
             $values_attribute = array();
             foreach ($entry as $_field => $_value) {
                 if (preg_match('/^custom_attribute_/', $_field) && $_value) {
                     $attribute_id = (int) ltrim($_field, 'custom_attribute_');
                     $values_attribute[] = array('name' => $attributes[$attribute_id]['column_name'], 'value' => $_value, 'datatype' => $attributes[$attribute_id]['datatype']);
                 }
             }
             $sorequest->add($request, $values_attribute);
         }
     }
     $this->_db->transaction_commit();
 }
开发者ID:HaakonME,项目名称:porticoestate,代码行数:101,代码来源:class.socondition_survey.inc.php

示例12: edit

 function edit()
 {
     if (!$this->acl_add) {
         $this->bocommon->no_access();
         return;
     }
     $id = phpgw::get_var($this->location_info['id']['name']);
     $values = phpgw::get_var('values');
     $values_attribute = phpgw::get_var('values_attribute');
     $GLOBALS['phpgw_info']['apps']['manual']['section'] = 'general.edit.' . $this->type;
     $GLOBALS['phpgw']->xslttpl->add_file(array('generic', 'attributes_form'));
     $receipt = array();
     if (is_array($values)) {
         $insert_record_attributes = $GLOBALS['phpgw']->session->appsession("insert_record_values{$this->acl_location}", $this->location_info['acl_app']);
         if (is_array($insert_record_attributes)) {
             foreach ($insert_record_attributes as $attribute) {
                 foreach ($values_attribute as &$attr) {
                     if ($attr['name'] == $attribute) {
                         $attr['value'] = phpgw::get_var($attribute, 'string', 'POST');
                     }
                 }
             }
         }
         //				$values = $this->bocommon->collect_locationdata($values,$insert_record_values);
         if (isset($values['save']) && $values['save'] || isset($values['apply']) && $values['apply']) {
             if ($GLOBALS['phpgw']->session->is_repost()) {
                 $receipt['error'][] = array('msg' => lang('Hmm... looks like a repost!'));
             }
             if (!$id && !$values[$this->location_info['id']['name']] && $this->location_info['id']['type'] != 'auto') {
                 $receipt['error'][] = array('msg' => lang('missing value for %1', lang('id')));
             }
             foreach ($this->location_info['fields'] as $field_info) {
                 if (isset($field_info['nullable']) && $field_info['nullable'] != true) {
                     if (!$values[$field_info['name']]) {
                         $receipt['error'][] = array('msg' => lang('missing value for %1', $field_info['descr']));
                     }
                 }
                 if ($field_info['type'] == 'int') {
                     if ($values[$field_info['name']] && !ctype_digit($values[$field_info['name']])) {
                         $receipt['error'][] = array('msg' => "{$field_info['descr']}: " . lang('Please enter an integer !'));
                     }
                 } else {
                     if ($field_info['type'] == 'numeric') {
                         $values[$field_info['name']] = str_replace(',', '.', $values[$field_info['name']]);
                         if ($values[$field_info['name']] && !is_numeric($values[$field_info['name']])) {
                             $receipt['error'][] = array('msg' => "{$field_info['descr']}: " . lang('Please enter a numeric value !'));
                         }
                     }
                 }
             }
             if ($values['id'] && $this->location_info['id']['type'] == 'int' && !ctype_digit($values['id'])) {
                 $receipt['error'][] = array('msg' => lang('Please enter an integer !'));
                 unset($values['id']);
             }
             if (isset($values_attribute) && is_array($values_attribute)) {
                 foreach ($values_attribute as $attribute) {
                     if ($attribute['nullable'] != 1 && (!$attribute['value'] && !$values['extra'][$attribute['name']])) {
                         $receipt['error'][] = array('msg' => lang('Please enter value for attribute %1', $attribute['input_text']));
                     }
                     if (isset($attribute['value']) && $attribute['value'] && $attribute['datatype'] == 'I' && !ctype_digit($attribute['value'])) {
                         $receipt['error'][] = array('msg' => lang('Please enter integer for attribute %1', $attribute['input_text']));
                     }
                 }
             }
             if ($id) {
                 $values['id'] = $id;
                 $action = 'edit';
             } else {
                 $id = $values['id'];
             }
             if (!$receipt['error']) {
                 $receipt = $this->bo->save($values, $action, $values_attribute);
                 if (isset($values['save']) && $values['save']) {
                     $GLOBALS['phpgw']->session->appsession('session_data', "general_receipt_{$this->type}_{$this->type_id}", $receipt);
                     $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 'property.uigeneric.index', 'appname' => $this->appname, 'type' => $this->type, 'type_id' => $this->type_id));
                 }
                 $id = $receipt['id'];
             }
         } else {
             $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 'property.uigeneric.index', 'appname' => $this->appname, 'type' => $this->type, 'type_id' => $this->type_id));
         }
     }
     if ($id) {
         $values = $this->bo->read_single(array('id' => $id));
         $function_msg = $this->location_info['edit_msg'];
         $action = 'edit';
     } else {
         $values = $this->bo->read_single();
         $function_msg = $this->location_info['add_msg'];
         $action = 'add';
     }
     /* Preserve attribute values from post */
     if (isset($receipt['error'])) {
         foreach ($this->location_info['fields'] as $field) {
             $values[$field['name']] = phpgw::clean_value($_POST['values'][$field['name']]);
         }
         if (isset($values_attribute) && is_array($values_attribute)) {
             $values = $this->custom->preserve_attribute_values($values, $values_attribute);
         }
     }
//.........这里部分代码省略.........
开发者ID:HaakonME,项目名称:porticoestate,代码行数:101,代码来源:class.uigeneric.inc.php

示例13: foreach

$forward = phpgw::get_var('phpgw_forward', 'int');
if ($forward) {
    $extra_vars['phpgw_forward'] = $forward;
    foreach ($_GET as $name => $value) {
        if (preg_match('/phpgw_/', $name)) {
            $extra_vars[$name] = phpgw::clean_value($value);
        }
    }
}
$redirect = phpgw::get_var('redirect_menuaction', 'string');
if ($redirect) {
    $matches = array();
    $extra_vars['menuaction'] = $redirect;
    foreach ($_GET as $name => $value) {
        if (preg_match('/^redirect_([\\w\\_\\-]+)/', $name, $matches) && $matches[1] != 'menuaction') {
            $extra_vars[$matches[1]] = phpgw::clean_value($value);
        }
    }
}
if (!isset($extra_vars['menuaction'])) {
    $extra_vars['menuaction'] = 'bookingfrontend.uisearch.index';
}
if (!$external_logout) {
    $GLOBALS['phpgw']->redirect_link('/bookingfrontend/', $extra_vars);
} else {
    $result_redirect = '';
    if (substr($external_logout, -1) == '=') {
        $result_redirect = $GLOBALS['phpgw']->link('/bookingfrontend/', $extra_vars, true);
    }
    $external_logout_url = "{$external_logout}{$bookingfrontend_host}{$result_redirect}";
    Header("Location: {$external_logout_url}");
开发者ID:HaakonME,项目名称:porticoestate,代码行数:31,代码来源:logout.php

示例14: extract_values

/**
 * Cherry pick selected values into a new array
 * 
 * @param array $array    input array
 * @param array $keys     array of keys to pick
 *
 * @return array containg values from $array for the keys in $keys.
 */
function extract_values($array, $keys, $options = array())
{
    static $default_options = array('prefix' => '', 'suffix' => '', 'preserve_prefix' => false, 'preserve_suffix' => false);
    $options = array_merge($default_options, $options);
    $result = array();
    $isIndexed = array_values($keys) === $keys;
    if ($isIndexed) {
        foreach ($keys as $write_key) {
            $array_key = $options['prefix'] . $write_key . $options['suffix'];
            if (isset($array[$array_key])) {
                $result[($options['preserve_prefix'] ? $options['prefix'] : '') . $write_key . ($options['preserve_suffix'] ? $options['suffix'] : '')] = phpgw::clean_value($array[$array_key]);
            }
        }
    } else {
        foreach ($keys as $write_key => $type) {
            switch ($type) {
                case 'string':
                default:
                    $_type = 'string';
                    break;
                case 'bool':
                case 'boolean':
                    $_type = 'bool';
                    break;
                case 'int':
                case 'integer':
                case 'number':
                    $_type = 'int';
                    break;
                case 'float':
                case 'double':
                    $_type = 'float';
                    break;
                    /* Specific string types */
                /* Specific string types */
                case 'color':
                    $_type = 'color';
                    break;
                case 'email':
                    $_type = 'email';
                    break;
                case 'filename':
                    $_type = 'filename';
                    break;
                case 'ip':
                    $_type = 'ip';
                    break;
                case 'location':
                    $_type = 'location';
                    break;
                case 'url':
                    $_type = 'url';
                    break;
                    /* only use this if you really know what you are doing */
                /* only use this if you really know what you are doing */
                case 'raw':
                    $_type = 'raw';
                    break;
                case 'html':
                    $_type = 'html';
                    break;
            }
            $array_key = $options['prefix'] . $write_key . $options['suffix'];
            if (isset($array[$array_key])) {
                $result[($options['preserve_prefix'] ? $options['prefix'] : '') . $write_key . ($options['preserve_suffix'] ? $options['suffix'] : '')] = phpgw::clean_value($array[$array_key], $_type);
            }
        }
    }
    return $result;
}
开发者ID:HaakonME,项目名称:porticoestate,代码行数:78,代码来源:class.uicommon.inc.php


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