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


PHP Person::select方法代码示例

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


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

示例1: isReferenced

 public static function isReferenced($id)
 {
     require_once 'Person.php';
     $person = new Person();
     $select = $person->select();
     $select->where("facility_id = ?", $id);
     $select->where("is_deleted = 0");
     if ($person->fetchRow($select)) {
         return true;
     }
     return false;
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:12,代码来源:Facility.php

示例2: tryFind

 public static function tryFind($first, $middle, $last)
 {
     $first = trim($first);
     $middle = trim($middle);
     $last = trim($last);
     if ($first == '' && $middle == '' && $last == '') {
         return null;
     }
     $p = new Person();
     $select = $p->select()->from($p->_name, array('id', 'first_name', 'middle_name', 'last_name'));
     if ($first) {
         $select = $select->where("first_name like ?", $first);
     }
     if ($middle) {
         $select = $select->where("middle_name like ?", $middle);
     }
     if ($last) {
         $select = $select->where("last_name like ?", $last);
     }
     $res = $p->fetchRow($select);
     return $res->id ? $res->id : null;
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:22,代码来源:Person.php

示例3: my_ledcoin

 public function my_ledcoin()
 {
     auth_redirect_if_not_authentificated('errormessage/no_auth');
     $this->load->helper('filter');
     $post = $this->input->post();
     if ($post !== FALSE) {
         $post_filter = $this->input->post('filter');
         if ($post_filter !== FALSE) {
             filter_store_filter(self::FILTER_MY_LEDCOIN_TABLE, $post_filter);
         }
         redirect('ledcoin/my_ledcoin');
     }
     $filter = filter_get_filter(self::FILTER_MY_LEDCOIN_TABLE, array('page' => 1));
     $operations_addition = new Operation();
     $operations_addition->where('type', Operation::TYPE_ADDITION);
     $operations_addition->select_sum('amount', 'amount_sum');
     $operations_addition->where_related_person('id', '${parent}.id');
     $operations_mining = new Operation();
     $operations_mining->where('type', Operation::TYPE_ADDITION);
     $operations_mining->where('addition_type', Operation::ADDITION_TYPE_MINING);
     $operations_mining->select_sum('amount', 'amount_sum');
     $operations_mining->where_related_person('id', '${parent}.id');
     $operations_subtraction_direct = new Operation();
     $operations_subtraction_direct->where('type', Operation::TYPE_SUBTRACTION);
     $operations_subtraction_direct->where('subtraction_type', Operation::SUBTRACTION_TYPE_DIRECT);
     $operations_subtraction_direct->select_sum('amount', 'amount_sum');
     $operations_subtraction_direct->where_related_person('id', '${parent}.id');
     $operations_subtraction_products = new Operation();
     $operations_subtraction_products->where('type', Operation::TYPE_SUBTRACTION);
     $operations_subtraction_products->where('subtraction_type', Operation::SUBTRACTION_TYPE_PRODUCTS);
     $operations_subtraction_products->where_related('product_quantity', 'price >', 0);
     $operations_subtraction_products->group_start(' NOT', 'AND');
     $operations_subtraction_products->where_related('product_quantity', 'product_id', NULL);
     $operations_subtraction_products->group_end();
     unset($operations_subtraction_products->db->ar_select[0]);
     $operations_subtraction_products->select_func('SUM', array('@product_quantities.quantity', '*', '@product_quantities.price', '*', '@product_quantities.multiplier'), 'amount_sum');
     $operations_subtraction_products->where_related_person('id', '${parent}.id');
     $operations_subtraction_services = new Operation();
     $operations_subtraction_services->where('type', Operation::TYPE_SUBTRACTION);
     $operations_subtraction_services->where('subtraction_type', Operation::SUBTRACTION_TYPE_SERVICES);
     $operations_subtraction_services->where_related('service_usage', 'price >', 0);
     $operations_subtraction_services->group_start(' NOT', 'AND');
     $operations_subtraction_services->where_related('service_usage', 'service_id', NULL);
     $operations_subtraction_services->group_end();
     unset($operations_subtraction_services->db->ar_select[0]);
     $operations_subtraction_services->select_func('SUM', array('@service_usages.quantity', '*', '@service_usages.price', '*', '@service_usages.multiplier'), 'amount_sum');
     $operations_subtraction_services->where_related_person('id', '${parent}.id');
     $person = new Person();
     $person->where('admin', 0);
     $person->select('*');
     $person->select_subquery($operations_addition, 'plus_amount');
     $person->select_subquery($operations_mining, 'plus_mined');
     $person->select_subquery($operations_subtraction_direct, 'minus_amount_direct');
     $person->select_subquery($operations_subtraction_products, 'minus_amount_products');
     $person->select_subquery($operations_subtraction_services, 'minus_amount_services');
     $person->include_related('group', 'title');
     $person->get_by_id(auth_get_id());
     if (!$person->exists()) {
         add_error_flash_message('Nenašla sa informácia o prihlásenom používateľovi. Nemôžete si pozrieť svoj LEDCOIN.');
         redirect(site_url('ledcoin'));
     }
     $operations = new Operation();
     $operations->select('id, created, amount, type, subtraction_type, addition_type, comment');
     $operations->include_related('admin', array('name', 'surname'));
     $operations->include_related('workplace', 'title');
     $operations->where_related_person($person);
     $operations->order_by('created', 'asc');
     $operations->get_paged_iterated($filter['page'], self::MY_LEDCOIN_TABLE_ROWS_PER_PAGE);
     $this->parser->parse('web/controllers/ledcoin/my_ledcoin.tpl', array('title' => 'Môj LEDCOIN', 'operations' => $operations, 'person' => $person, 'form' => $this->get_my_ledcoin_filter_form($filter, $operations->paged)));
 }
开发者ID:andrejjursa,项目名称:lstme-ledcoin,代码行数:70,代码来源:ledcoin.php

示例4: personsAction

 public function personsAction()
 {
     try {
         require_once 'models/table/Person.php';
         $personTable = new Person();
         $select = $personTable->select()->from('person', array('*'))->setIntegrityCheck(false);
         $rowRay = $personTable->fetchAll($select);
         $rowRay = @$rowRay->toArray();
         //sort by id
         $sorted = array();
         foreach ($rowRay as $row) {
             unset($row['suffix_option_id']);
             unset($row['title_option_id']);
             $sorted[$row['id']] = $row;
         }
         /*
         $sorted = $personTable->_fill_lookup($sorted, 'location_city', 'home_city_id', 'city_name');
         $sorted = $personTable->_fill_lookup($sorted, 'location_district', 'home_district_id', 'district_name');
         $sorted = $personTable->_fill_lookup($sorted, 'location_province', 'home_province_id', 'province_name');
         */
         $locations = Location::getAll();
         foreach ($sorted as $id => $row) {
             $city_info = Location::getCityInfo($row['home_location_id'], $this->setting('num_location_tiers'), $locations);
             if (count($city_info)) {
                 if ($city_info[0]) {
                     $sorted[$id]['city_name'] = $city_info[0];
                 }
                 if ($city_info[1]) {
                     $sorted[$id]['province_name'] = $locations[$city_info[1]]['name'];
                 }
                 if ($city_info[2]) {
                     $sorted[$id]['district_name'] = $locations[$city_info[2]]['name'];
                 }
                 if ($city_info[3]) {
                     $sorted[$id]['region_c_name'] = $locations[$city_info[3]]['name'];
                 }
                 if ($city_info[4]) {
                     $sorted[$id]['region_d_name'] = $locations[$city_info[4]]['name'];
                 }
                 if ($city_info[5]) {
                     $sorted[$id]['region_e_name'] = $locations[$city_info[5]]['name'];
                 }
                 if ($city_info[6]) {
                     $sorted[$id]['region_f_name'] = $locations[$city_info[6]]['name'];
                 }
                 if ($city_info[7]) {
                     $sorted[$id]['region_g_name'] = $locations[$city_info[7]]['name'];
                 }
                 if ($city_info[8]) {
                     $sorted[$id]['region_h_name'] = $locations[$city_info[8]]['name'];
                 }
                 if ($city_info[9]) {
                     $sorted[$id]['region_i_name'] = $locations[$city_info[9]]['name'];
                 }
             }
             unset($sorted[$id]['home_location_id']);
         }
         $sorted = $personTable->_fill_lookup($sorted, 'person_qualification_option', 'primary_qualification_option_id', 'qualification_phrase');
         $sorted = $personTable->_fill_lookup($sorted, 'person_primary_responsibility_option', 'primary_responsibility_option_id', 'responsibility_phrase');
         $sorted = $personTable->_fill_lookup($sorted, 'person_secondary_responsibility_option', 'secondary_responsibility_option_id', 'responsibility_phrase');
         $sorted = $personTable->_fill_lookup($sorted, 'person_custom_1_option', 'person_custom_1_option_id', 'custom1_phrase');
         $sorted = $personTable->_fill_lookup($sorted, 'person_custom_2_option', 'person_custom_2_option_id', 'custom2_phrase');
         $sorted = $personTable->_fill_lookup($sorted, 'facility', 'facility_id', 'facility_name');
         //fill participants
         $select = $personTable->select()->from('person', array('id'))->setIntegrityCheck(false)->join(array('pt' => 'person_to_training'), "pt.person_id = person.id", array('training_id'))->join(array('t' => 'training'), "pt.training_id = t.id", array())->join(array('tt' => 'training_title_option'), "t.training_title_option_id = tt.id", array('training_title_phrase'));
         $rows = $personTable->fetchAll($select);
         foreach ($rows as $row) {
             $pid = $row->id;
             $ra = $row->toArray();
             unset($ra['id']);
             $sorted[$pid]['courses'][] = $ra;
         }
         //fill trainers
         $select = $personTable->select()->from('trainer', array('person_id'))->setIntegrityCheck(false)->join(array('pt' => 'training_to_trainer'), "pt.trainer_id = trainer.person_id", array('training_id'))->join(array('t' => 'training'), "pt.training_id = t.id", array())->join(array('tt' => 'training_title_option'), "t.training_title_option_id = tt.id", array('training_title_phrase'));
         $rows = $personTable->fetchAll($select);
         foreach ($rows as $row) {
             $pid = $row->person_id;
             $ra = $row->toArray();
             unset($ra['person_id']);
             $sorted[$pid]['trained'][] = $ra;
         }
         if ($this->getSanParam('outputType') == 'csv') {
             $this->sendData($this->reportHeaders(false, $sorted));
         }
         $this->view->assign('data', $sorted);
     } catch (Exception $e) {
         echo $e->getMessage() . "<br>" . PHP_EOL;
     }
 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:89,代码来源:DataController.php

示例5: Person

 function people_get()
 {
     if (!$this->get('search')) {
         $this->response(NULL, 400);
     }
     //echo $this->get('search');
     $people = new Person();
     $people->select('id, name, pfsnumber, public, country');
     $people->or_like('name', $this->get('search'));
     $people->or_like('pfsnumber', $this->get('search'));
     $people->order_by('name', 'asc');
     $people->limit(5);
     $people->get();
     if ($people->exists()) {
         $people_array = $people->all_to_array();
         $this->response($people_array, 200);
         // 200 being the HTTP response code
     } else {
         $this->response(array('error' => 'People could not be found'), 404);
     }
 }
开发者ID:TetsujinOni,项目名称:PFS-Scenariotracker,代码行数:21,代码来源:V1.php

示例6: testDeleteCriteria

 public function testDeleteCriteria()
 {
     $this->prepareDB(true);
     $oDriver = DBDriver::get_instance('sqlite', array('filename' => dirname(__FILE__) . '/unittest.db'));
     $mRes = Person::delete('Person')->where('lastName', 'Piochet')->exec($oDriver);
     $mRes = Person::select('Person')->where('lastName', 'Piochet')->exec($oDriver);
     $this->assertEquals(0, $mRes->numRows());
 }
开发者ID:poitch,项目名称:dokin,代码行数:8,代码来源:SQLiteTest.php

示例7: testDeleteMultiple

 public function testDeleteMultiple()
 {
     $oDriver = DBDriver::get_instance('mongo');
     // Clean up database
     Person::delete('Person')->where('firstName', 'Jerome')->exec($oDriver);
     $iCount = 10;
     for ($i = 0; $i < $iCount; $i++) {
         $oPerson = new Person();
         $oPerson->firstName = 'Jerome';
         $oPerson->lastName = 'Poichet';
         $mRes = $oPerson->insert()->exec($oDriver);
     }
     $oRes = Person::select('Person')->where('firstName', 'Jerome')->exec($oDriver);
     $this->assertEquals($iCount, $oRes->numRows());
     Person::delete('Person')->where('firstName', 'Jerome')->exec($oDriver);
     $oRes = Person::select('Person')->where('firstName', 'Jerome')->exec($oDriver);
     $this->assertEquals(0, $oRes->numRows());
 }
开发者ID:poitch,项目名称:dokin,代码行数:18,代码来源:MongoTest.php

示例8: get_form

 public function get_form($type = '', $subtraction_type = '')
 {
     $this->load->helper('operations');
     $operations_addition = new Operation();
     $operations_addition->where('type', Operation::TYPE_ADDITION);
     $operations_addition->select_sum('amount', 'amount_sum');
     $operations_addition->where_related_person('id', '${parent}.id');
     $operations_subtraction_direct = new Operation();
     $operations_subtraction_direct->where('type', Operation::TYPE_SUBTRACTION);
     $operations_subtraction_direct->where('subtraction_type', Operation::SUBTRACTION_TYPE_DIRECT);
     $operations_subtraction_direct->select_sum('amount', 'amount_sum');
     $operations_subtraction_direct->where_related_person('id', '${parent}.id');
     $operations_subtraction_products = new Operation();
     $operations_subtraction_products->where('type', Operation::TYPE_SUBTRACTION);
     $operations_subtraction_products->where('subtraction_type', Operation::SUBTRACTION_TYPE_PRODUCTS);
     $operations_subtraction_products->where_related('product_quantity', 'price >', 0);
     $operations_subtraction_products->group_start(' NOT', 'AND');
     $operations_subtraction_products->where_related('product_quantity', 'product_id', NULL);
     $operations_subtraction_products->group_end();
     unset($operations_subtraction_products->db->ar_select[0]);
     $operations_subtraction_products->select_func('SUM', array('@product_quantities.quantity', '*', '@product_quantities.price', '*', '@product_quantities.multiplier'), 'amount_sum');
     $operations_subtraction_products->where_related_person('id', '${parent}.id');
     $operations_subtraction_services = new Operation();
     $operations_subtraction_services->where('type', Operation::TYPE_SUBTRACTION);
     $operations_subtraction_services->where('subtraction_type', Operation::SUBTRACTION_TYPE_SERVICES);
     $operations_subtraction_services->where_related('service_usage', 'price >', 0);
     $operations_subtraction_services->group_start(' NOT', 'AND');
     $operations_subtraction_services->where_related('service_usage', 'service_id', NULL);
     $operations_subtraction_services->group_end();
     unset($operations_subtraction_services->db->ar_select[0]);
     $operations_subtraction_services->select_func('SUM', array('@service_usages.quantity', '*', '@service_usages.price', '*', '@service_usages.multiplier'), 'amount_sum');
     $operations_subtraction_services->where_related_person('id', '${parent}.id');
     $persons = new Person();
     $persons->order_by('surname', 'asc')->order_by('name', 'asc');
     $persons->where('admin', 0);
     $persons->select('*');
     $persons->select_subquery($operations_addition, 'plus_amount');
     $persons->select_subquery($operations_subtraction_direct, 'minus_amount_direct');
     $persons->select_subquery($operations_subtraction_products, 'minus_amount_products');
     $persons->select_subquery($operations_subtraction_services, 'minus_amount_services');
     $persons->include_related('group', 'title');
     $persons->get_iterated();
     $persons_select = array('' => '');
     foreach ($persons as $person) {
         $amount = doubleval($person->plus_amount) - intval($person->minus_amount_direct) - intval($person->minus_amount_products) - intval($person->minus_amount_services);
         $persons_select[$person->id] = $person->name . ' ' . $person->surname . ' (' . $person->group_title . ' | LEDCOIN: ' . $amount . ' ' . get_inflection_ledcoin($amount) . ')';
     }
     $workplaces = new Workplace();
     $workplaces->order_by('title', 'asc');
     $workplaces->get_iterated();
     $workplaces_select = array('' => '');
     foreach ($workplaces as $workplace) {
         $workplaces_select[$workplace->id] = $workplace->title;
     }
     $form = array('fields' => array('type' => array('name' => 'operation[type]', 'type' => 'select', 'id' => 'operation-type', 'label' => 'Typ operácie', 'data' => array('stay-visible' => 'true'), 'values' => array('' => '', Operation::TYPE_ADDITION => 'Pridanie LEDCOIN-u', Operation::TYPE_SUBTRACTION => 'Odobratie LEDCOIN-u'), 'validation' => 'required'), 'subtraction_type' => array('name' => 'operation[subtraction_type]', 'type' => 'select', 'id' => 'operation-subtraction_type', 'label' => 'Spôsob odobratia LEDCOIN-u', 'data' => array('stay-visible' => 'true'), 'values' => array('' => '', Operation::SUBTRACTION_TYPE_DIRECT => 'Priame odobratie LEDCOIN-u', Operation::SUBTRACTION_TYPE_PRODUCTS => 'Nákup v bufete', Operation::SUBTRACTION_TYPE_SERVICES => 'Využitie služieb'), 'validation' => 'required'), 'addition_type' => array('name' => 'operation[addition_type]', 'type' => 'select', 'id' => 'operation-addition_type', 'data' => array('stay-visivle' => 'true'), 'label' => 'Spôsob pridania LEDCOIN-u', 'values' => array('' => '', Operation::ADDITION_TYPE_TRANSFER => 'Prevod z účtu vedúcich', Operation::ADDITION_TYPE_MINING => 'Vydolovanie LEDCOIN-u'), 'validation' => 'required'), 'person' => array('name' => 'operation[person_id]', 'type' => 'select', 'id' => 'operation-person_id', 'label' => 'Účastník', 'data' => array('stay-visible' => 'true'), 'values' => $persons_select, 'validation' => 'required'), 'workplace' => array('name' => 'operation[workplace_id]', 'type' => 'select', 'id' => 'operation-workplace_id', 'data' => array('stay-visible' => 'true'), 'label' => 'Zamestnanie', 'values' => $workplaces_select), 'comment' => array('name' => 'operation[comment]', 'type' => 'text_input', 'id' => 'comment-id', 'label' => 'Komentár', 'data' => array('stay-visible' => 'true'), 'validation' => 'max_length[255]'), 'amount' => array('name' => 'operation[amount]', 'type' => 'slider', 'id' => 'comment-amount', 'label' => 'LEDCOIN', 'data' => array('stay-visible' => 'true'), 'min' => 0, 'max' => 25, 'step' => 0.1, 'default' => 0, 'validation' => array(array('if-field-not-equals' => array('field' => 'operation[amount]', 'value' => 0), 'rules' => 'required|floatpoint|convert_floatpoint|greater_than[0]'))), 'multiplier-fake' => array('name' => 'operation[multiplier-fake]', 'type' => 'text_input', 'disabled' => true, 'id' => 'operation-multiplier-fake', 'default' => operations_ledcoin_multiplier(), 'label' => 'Multiplikátor LEDCOIN-u'), 'multiplier' => array('name' => 'operation[multiplier]', 'type' => 'hidden', 'default' => operations_ledcoin_multiplier())), 'arangement' => array('type', 'person', 'workplace', 'comment'));
     if ($type == Operation::TYPE_SUBTRACTION) {
         if ($subtraction_type == Operation::SUBTRACTION_TYPE_DIRECT) {
             $form['arangement'] = array('type', 'subtraction_type', 'person', 'workplace', 'comment', 'amount');
         } elseif ($subtraction_type == Operation::SUBTRACTION_TYPE_SERVICES) {
             $form['arangement'] = array('type', 'subtraction_type', 'person', 'comment', 'multiplier', 'multiplier-fake');
             $services = new Service();
             $services->order_by('title', 'asc');
             $services->get_iterated();
             foreach ($services as $service) {
                 $form['fields']['service_' . $service->id . '_quantity'] = array('name' => 'operation_service[' . $service->id . '][quantity]', 'class' => 'controlls-services', 'id' => 'operation_service-' . $service->id . '-quantity', 'type' => 'slider', 'min' => 0, 'max' => 240, 'label' => $service->title . ' (LEDCOIN)', 'data' => array('service-title' => $service->title), 'default' => 0, 'validation' => array(array('if-field-not-equals' => array('field' => 'operation_service[' . $service->id . '][quantity]', 'value' => 0), 'rules' => 'required|integer|greater_than[0]')));
                 $form['fields']['service_' . $service->id . '_price'] = array('name' => 'operation_service[' . $service->id . '][price]', 'class' => 'controlls-services', 'id' => 'operation_service-' . $service->id . '-price', 'type' => 'text_input', 'label' => $service->title . ' (cena za minútu)', 'data' => array('service-title' => $service->title), 'default' => $service->price, 'validation' => array(array('if-field-not-equals' => array('field' => 'operation_service[' . $service->id . '][quantity]', 'value' => 0), 'rules' => 'required|floatpoint|convert_floatpoint|greater_than[0]')));
                 $form['arangement'][] = 'service_' . $service->id . '_quantity';
                 $form['arangement'][] = 'service_' . $service->id . '_price';
             }
         } elseif ($subtraction_type == Operation::SUBTRACTION_TYPE_PRODUCTS) {
             $form['arangement'] = array('type', 'subtraction_type', 'person', 'comment', 'multiplier', 'multiplier-fake');
             $quantity_addition = new Product_quantity();
             $quantity_addition->select_sum('quantity', 'quantity_sum');
             $quantity_addition->where('type', Product_quantity::TYPE_ADDITION);
             $quantity_addition->where_related('product', 'id', '${parent}.id');
             $quantity_subtraction = new Product_quantity();
             $quantity_subtraction->select_sum('quantity', 'quantity_sum');
             $quantity_subtraction->where('type', Product_quantity::TYPE_SUBTRACTION);
             $quantity_subtraction->where_related('product', 'id', '${parent}.id');
             $products = new Product();
             $products->order_by('title', 'asc');
             $products->select('*');
             $products->select_subquery($quantity_addition, 'plus_quantity');
             $products->select_subquery($quantity_subtraction, 'minus_quantity');
             $products->get_iterated();
             $p = 1;
             foreach ($products as $product) {
                 $form['fields']['product_' . $product->id . '_quantity'] = array('name' => 'operation_product[' . $product->id . '][quantity]', 'class' => 'controlls-products', 'id' => 'operation_product-' . $product->id . '-quantity', 'type' => 'slider', 'min' => 0, 'max' => intval($product->plus_quantity) - intval($product->minus_quantity), 'label' => '<span class="product_title_label"><img src="' . get_product_image_min($product->id) . '" alt="" /><span class="product_title">' . $product->title . ' (počet kusov)</span></span>', 'default' => 0, 'disabled' => intval($product->plus_quantity) - intval($product->minus_quantity) <= 0 ? true : false, 'data' => array('product-title' => $product->title), 'validation' => array(array('if-field-not-equals' => array('field' => 'operation_product[' . $product->id . '][quantity]', 'value' => 0), 'rules' => 'required|integer|greater_than[0]|less_than_equals[' . (intval($product->plus_quantity) - intval($product->minus_quantity)) . ']')));
                 $form['fields']['product_' . $product->id . '_price'] = array('name' => 'operation_product[' . $product->id . '][price]', 'class' => 'controlls-products', 'id' => 'operation_product-' . $product->id . '-price', 'type' => 'text_input', 'label' => $product->title . ' (cena za kus)', 'default' => $product->price, 'disabled' => intval($product->plus_quantity) - intval($product->minus_quantity) <= 0 ? true : false, 'data' => array('product-title' => $product->title), 'validation' => array(array('if-field-not-equals' => array('field' => 'operation_product[' . $product->id . '][quantity]', 'value' => 0), 'rules' => 'required|floatpoint|convert_floatpoint|greater_than[0]')));
                 $form['arangement'][] = 'product_' . $product->id . '_quantity';
                 $form['arangement'][] = 'product_' . $product->id . '_price';
                 if ($p < $products->result_count()) {
                     $form['fields']['product_' . $product->id . '_divider'] = array('type' => 'divider', 'data' => array('product-title' => $product->title));
                     $form['arangement'][] = 'product_' . $product->id . '_divider';
                 }
                 $p++;
             }
         } else {
             $form['arangement'] = array('type', 'subtraction_type', 'person');
         }
//.........这里部分代码省略.........
开发者ID:andrejjursa,项目名称:lstme-ledcoin,代码行数:101,代码来源:operations.php

示例9: importAction


//.........这里部分代码省略.........
                     unset($values['timestamp_updated']);
                 }
                 if (!$this->hasACL('approve_trainings')) {
                     unset($values['approved']);
                 }
                 #if ( $values['sponsor_option_id'] ) {
                 #	$sponsors = $this->_array_me($values['sponsor_option_id']); // could be an array, we dont want one
                 #	$values['sponsor_option_id'] = $sponsors[0];
                 #}
                 //locations
                 $num_location_tiers = $this->setting('num_location_tiers');
                 $bSuccess = true;
                 $location_id = null;
                 if ($values['facility_name']) {
                     if (!$values['facility_id']) {
                         if (is_array($values['facility_name'])) {
                             $values['facility_id'] = $values['facility_name'][0];
                         } else {
                             if (is_numeric($values['facility_name'])) {
                                 $values['facility_id'] = $values['facility_name'];
                             }
                         }
                         //else
                         //$errs[] = t ('Not able to set facility location for: ').$values['first_name'].space.$values['last_name'];
                     }
                 }
                 if (!$bSuccess) {
                     $errs[] = t('Error locating/creating region or city:') . ' ' . $row[$r] . ' ' . t('Facility') . ': ' . $values['facility_name'];
                     continue;
                     // couldnt save location
                 }
                 //dupecheck
                 $dupe = new Person();
                 $select = $dupe->select()->where('facility_id = "' . $values['facility_id'] . '" and first_name = "' . $values['first_name'] . '" and last_name = "' . $values['last_name'] . '"');
                 if ($dupe->fetchRow($select)) {
                     $errs[] = t('A person with this name already exists in the database, the user was not added.') . space . t('Name') . ': ' . $values['first_name'] . space . $values['last_name'];
                     $bSuccess = false;
                 }
                 if (!$bSuccess) {
                     continue;
                 }
                 //field mapping (Export vs import)
                 if (isset($values["qualification_phrase"])) {
                     $values["primary_qualification_option_id"] = $values["qualification_phrase"];
                 }
                 if (isset($values["primary_qualification_phrase"])) {
                     $values["primary_qualification_option_id"] = $values["primary_qualification_phrase"];
                 }
                 if (isset($values["primary_responsibility_phrase"])) {
                     $values["primary_responsibility_option_id"] = $values["primary_responsibility_phrase"];
                 }
                 if (isset($values["secondary_responsibility_phrase"])) {
                     $values["secondary_responsibility_option_id"] = $values["secondary_responsibility_phrase"];
                 }
                 if (isset($values["highest_edu_level_phrase"])) {
                     $values["highest_edu_level_option_id"] = $values["highest_edu_level_phrase"];
                 }
                 if (isset($values["attend_reason_phrase"])) {
                     $values["attend_reason_option_id"] = $values["attend_reason_phrase"];
                 }
                 if (isset($values["custom_1"])) {
                     $values["person_custom_1_option_id"] = $values["custom_1"];
                 }
                 if (isset($values["custom_2"])) {
                     $values["person_custom_2_option_id"] = $values["custom_2"];
                 }
开发者ID:falafflepotatoe,项目名称:trainsmart-code,代码行数:67,代码来源:PersonController.php


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