本文整理汇总了PHP中name函数的典型用法代码示例。如果您正苦于以下问题:PHP name函数的具体用法?PHP name怎么用?PHP name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onValidationEvent
protected function onValidationEvent($op, $id = false)
{
$this->data['invoice_types'] = dd2menu('invoice_types', ['invoice_type_id' => name()]);
$this->form_validation->set_rules('name_en', lang('departments_name_en'), "trim|required");
$this->form_validation->set_rules('name_ar', lang('departments_name_ar'), "trim|required");
$this->form_validation->set_rules('desc', lang('departments_desc'), "trim|required");
}
示例2: get_likes_phrase
/**
* get likes phrase
*
* @param ARRAY $likes
* @return STRING $phrase
*/
function get_likes_phrase($likes, $total_likes, $liked)
{
if ($total_likes > 0) {
if ($liked == 'yes') {
if ($total_likes > 2) {
$phrase = sprintf(lang('You and %s other like this'), $total_likes - 1);
} elseif ($total_likes == 2) {
foreach ($likes as $like) {
if ($like['userid'] != userid()) {
break;
}
}
$username = name($like);
$phrase = sprintf(lang('You and %s like this'), $username);
} else {
$phrase = lang('You like this');
}
} else {
if ($total_likes == 1) {
//$likes = $results['likes'];
foreach ($likes as $like) {
break;
}
$username = name($like);
$phrase = sprintf(lang('%s likes this post'), $username);
} else {
$phrase = sprintf(lang('%s people like this post'), $total_likes);
}
}
} else {
$phrase = lang('Be the first to like this post');
}
return $phrase;
}
示例3: onValidationEvent
protected function onValidationEvent($op, $id = false)
{
$this->data['device_types'] = dd2menu('device_types', ['device_type_id' => name()]);
$this->data['device_status'] = dd2menu('device_status', ['device_status_id' => name()]);
$this->data['warranties'] = dd2menu('warranties', ['warranty_id' => name()]);
$config['upload_path'] = './cdn/' . $this->_table;
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$this->load->library('upload', $config);
$required = $op == 'add' ? '1' : '0';
$this->form_validation->set_rules('device_type_id', lang('devices_device_type_id'), "trim|required");
$this->form_validation->set_rules('name_en', lang('devices_name_en'), "trim|required");
$this->form_validation->set_rules('name_ar', lang('devices_name_ar'), "trim|required");
$this->form_validation->set_rules('device_status_id', lang('devices_device_status_id'), "trim|required");
$this->form_validation->set_rules('free_sim', lang('devices_free_sim'), "trim|required");
$this->form_validation->set_rules('warranty_id', lang('devices_warranty_id'), "trim|required");
$this->form_validation->set_rules('warranty_days', lang('devices_warranty_days'), "trim|required");
$this->form_validation->set_rules('partner', lang('devices_partner'), "trim|required");
$this->form_validation->set_rules('cost', lang('devices_cost'), "trim|required");
$this->form_validation->set_rules('commision', lang('devices_commision'), "trim|required");
$this->form_validation->set_rules('price', lang('devices_price'), "trim|required");
$this->form_validation->set_rules('discount', lang('devices_discount'), "trim|required");
$this->form_validation->set_rules('desc', lang('devices_desc'), "trim|required");
$this->form_validation->set_rules('points', lang('devices_points'), "trim|required");
$this->form_validation->set_rules('barcode', lang('devices_barcode'), "trim|required");
// $this->form_validation->set_rules('logo', lang('branches_logo'), "callback_file[logo," . $required . "]");
}
示例4: onValidationEvent
protected function onValidationEvent($op, $id = false)
{
$this->data['branches'] = dd2menu('branches', ['branch_id' => 'name']);
$this->data['usergroups'] = dd2menu('usergroups', ['usergroup_id' => 'name']);
$this->data['user_status'] = dd2menu('user_status', ['user_status_id' => name()]);
$this->data['languages'] = ddlanguages();
$config['upload_path'] = './cdn/' . $this->_table;
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$this->load->library('upload', $config);
$required = $op == 'add' ? '1' : '0';
$this->form_validation->set_rules('branch_id', lang('users_branch_id'), "trim|required");
$this->form_validation->set_rules('usergroup_id', lang('users_usergroup_id'), "trim|required");
$this->form_validation->set_rules('language', lang('users_language'), "trim|required");
$this->form_validation->set_rules('username', lang('users_username'), "trim|required");
$this->form_validation->set_rules('full_name', lang('users_full_name'), "trim|required");
$this->form_validation->set_rules('email', lang('users_email'), "trim|required|valid_email");
$this->form_validation->set_rules('phone', lang('users_phone'), "trim|numeric");
$this->form_validation->set_rules('mobile', lang('users_mobile'), "trim|required|numeric");
$this->form_validation->set_rules('password', lang('users_password'), "trim" . $op == 'add' ? '|required' : null);
$this->form_validation->set_rules('address', lang('users_address'), "trim");
$this->form_validation->set_rules('notes', lang('users_notes'), "trim");
$this->form_validation->set_rules('salary', lang('users_salary'), "trim|numeric");
$this->form_validation->set_rules('commision', lang('users_commision'), "trim|required");
$this->form_validation->set_rules('id_no', lang('users_id_no'), "trim|required");
$this->form_validation->set_rules('id_expiredate', lang('users_id_expiredate'), "trim|required");
$this->form_validation->set_rules('passport_no', lang('users_passport_no'), "trim|required");
$this->form_validation->set_rules('passport_expiredate', lang('users_passport_expiredate'), "trim|required");
$this->form_validation->set_rules('status', lang('users_status'), "trim|required");
$this->form_validation->set_rules('image', lang('users_image'), "callback_file[image," . $required . "]");
}
示例5: appointments
/** Generates an array of events (JSON encoded) for the calender */
public function appointments()
{
$events = array();
// For each appointment, create an event
$appointments = $this->filter_appointments($this->input->post('start'), $this->input->post('end'));
foreach ($appointments as $appointment) {
// Participant, experiment and leader
$participant = $this->participationModel->get_participant_by_participation($appointment->id);
$experiment = $this->participationModel->get_experiment_by_participation($appointment->id);
$leader = $this->participationModel->get_user_by_participation($appointment->id);
// Begin and end datetime
$dateTime = new DateTime($appointment->appointment);
$startTime = $dateTime->format(DateTime::ISO8601);
$minutes = $experiment->duration + INSTRUCTION_DURATION;
$dateTime->add(new DateInterval('PT' . $minutes . 'M'));
$end = $dateTime->format(DateTime::ISO8601);
// Colors
$bgcolor = $experiment->experiment_color;
$textcolor = isset($bgcolor) ? get_foreground_color($bgcolor) : '';
// Title
$title = "\n" . name($participant);
$title .= "\n" . location_name($experiment->location_id);
if ($leader) {
$title .= ' / ' . $leader->firstname;
}
// Generate array for event
$event = array('title' => $title, 'start' => $startTime, 'end' => $end, 'color' => $bgcolor, 'textColor' => $textcolor, 'experiment' => $experiment->name, 'type' => $experiment->type, 'tooltip' => $this->generate_tooltip($appointment, $participant, $experiment), 'message' => $this->get_messages($appointment), 'className' => $appointment->cancelled != 0 ? 'event-cancelled' : '');
// Add array to events
array_push($events, $event);
}
// Returns a json array
echo json_encode($events);
}
示例6: indexFixes
public function indexFixes()
{
$this->{$this->model}->custom_select = '*';
// $this->{$this->model}->joins = array(
// 'business_types' => array('business_types.business_type_id = companies.business_type_id', 'inner')
// );
$this->{$this->model}->order_by[name()] = 'ASC';
}
示例7: onValidationEvent
protected function onValidationEvent($op, $id = false)
{
$this->data['fee_types'] = dd2menu('fee_types', ['fee_type_id' => name()]);
$this->form_validation->set_rules('branch_id', lang('fees_branch_id'), "trim|required");
$this->form_validation->set_rules('fee_type_id', lang('fees_fee_type_id'), "trim|required");
$this->form_validation->set_rules('amount', lang('fees_amount'), "trim|required");
$this->form_validation->set_rules('month', lang('fees_month'), "trim|required");
$this->form_validation->set_rules('year', lang('fees_year'), "trim|required");
}
示例8: memberLink
/**
* Return a member's name wrapped in an anchor tag linking to their profile page.
*
* @param int $memberId The ID of the member.
* @param string $username The username of the member.
* @return string
*/
function memberLink($memberId, $username = "")
{
$displayName = name($username);
if ($username) {
return "<a href='" . URL(memberURL($memberId, $username)) . "' title='" . sprintf(sanitizeHTML(T("View %s's profile")), $displayName) . "'>{$displayName}</a>";
} else {
return $displayName;
}
}
示例9: language_check
/** Checks whether participants listed as multilingual actually have more than one language added to them */
function language_check($participant)
{
$CI =& get_instance();
if ($participant->multilingual) {
$languages = $CI->languageModel->get_languages_by_participant($participant->id);
if (count($languages) <= 1) {
return array(sprintf(lang('verify_languages'), name($participant), participant_edit_link($participant->id)));
}
}
return array();
}
示例10: barcode_process
public function barcode_process($barcode)
{
if (!$barcode) {
die(json_encode(['error' => lang('orders_invalid_barcode')]));
}
$product = $this->db->where('barcode', $barcode)->get('products')->row();
if (!$product) {
die(json_encode(['error' => lang('orders_invalid_barcode')]));
}
echo json_encode(['product_id' => $product->product_id, 'product' => $product->{name()}, 'barcode' => $product->barcode, 'original_price' => $product->price, 'unit_price' => $product->price - $product->discount, 'discount' => $product->discount]);
}
示例11: onValidationEvent
protected function onValidationEvent($op, $id = false)
{
$this->data['invoice_types'] = dd2menu('invoice_types', ['invoice_type_id' => name()]);
$config['upload_path'] = './cdn/' . $this->_table;
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$this->load->library('upload', $config);
$required = $op == 'add' ? '1' : '1';
$this->form_validation->set_rules('name_ar', lang('cash_types_name_ar'), "trim|required");
$this->form_validation->set_rules('name_en', lang('cash_types_name_en'), "trim|required");
// $this->form_validation->set_rules('logo', lang('branches_logo'), "callback_file[logo," . $required ."]");
}
示例12: load_order_details
public function load_order_details($order_id)
{
if (!$order_id) {
show_404();
}
$products = [];
$orders_products = $this->db->where('pending_order_id', $order_id)->join('products', 'products.product_id = pending_order_products.product_id')->get('pending_order_products')->result();
foreach ($orders_products as $product) {
$products[] = ['product_id' => $product->product_id, 'product' => $product->{name()}, 'barcode' => $product->barcode, 'original_price' => $product->price, 'unit_price' => $product->price - $product->discount, 'discount' => $product->discount];
}
echo json_encode(['products' => $products]);
}
示例13: invoiceData
private function invoiceData($invoice_id)
{
$data['item'] = $this->db->select("invoices.*, users.full_name as user, clients.name as client, branches.name as branch, invoice_status." . name() . ' as status')->where('invoices.invoice_id', $invoice_id)->join('users', 'users.user_id = invoices.user_id', 'left')->join('clients', 'clients.client_id = invoices.client_id', 'left')->join('branches', 'branches.branch_id = invoices.branch_id', 'left')->join('invoice_status', 'invoice_status.invoice_status_id = invoices.invoice_status_id', 'left')->get('invoices')->row();
$data['order'] = $this->db->select('order_products.*, products.' . name() . ' as product')->where('orders.invoice_id', $invoice_id)->join('order_products', 'order_products.order_id = orders.order_id')->join('products', 'products.product_id = order_products.product_id')->get('orders')->result();
$data['device'] = $this->db->select('device_orders.*, devices.' . name() . ' as name, devices.price, devices.discount')->where('invoice_id', $invoice_id)->join('devices', 'devices.device_id = device_orders.device_id')->get('device_orders')->row();
$data['service'] = $this->db->select('service_orders.*, services.desc as name, services.price, services.discount')->where('invoice_id', $invoice_id)->join('services', 'services.service_id = service_orders.service_id')->get('service_orders')->row();
$data['maintenance'] = $this->db->select('*')->where('invoice_id', $invoice_id)->get('format_orders')->row();
$data['prepaid_card'] = $this->db->select('*')->where('invoice_id', $invoice_id)->join('prepaid_cards', 'prepaid_cards.prepaid_card_order_id = prepaid_card_orders.prepaid_card_order_id')->get('prepaid_card_orders')->result();
$data['branch'] = $this->db->select('*')->where('branch_id', $data['item']->branch_id)->get('branches')->result();
if ($data['order'][0]) {
$data['offline_transactions'] = $this->db->select('*')->where('order_id', $data['order'][0]->order_id)->get('offline_transactions')->result();
}
return $data;
}
示例14: dyslexia_check
/** Checks whether participants whose parents are listed as dyslexic actually have a dyslexia item added to them */
function dyslexia_check($participant)
{
$CI =& get_instance();
$result = array();
if ($participant->dyslexicparent) {
$genders = str_split($participant->dyslexicparent);
foreach ($genders as $gender) {
$dyslexia = $CI->dyslexiaModel->get_dyslexia_by_participant_gender($participant->id, $gender);
if (!$dyslexia) {
array_push($result, sprintf(lang('verify_dyslexia'), lcfirst(gender_parent($gender)), name($participant), anchor('dyslexia/add/', lang('here'), array('target' => '_blank'))));
}
}
}
return $result;
}
示例15: onValidationEvent
protected function onValidationEvent($op, $id = false)
{
$this->data['invoice_types'] = dd2menu('invoice_types', ['invoice_type_id' => name()]);
$config['upload_path'] = './cdn/' . $this->_table;
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$this->load->library('upload', $config);
$required = $op == 'add' ? '1' : '1';
$this->form_validation->set_rules('ticket_id', lang('tickets_ticket_id'), "trim|required");
$this->form_validation->set_rules('title', lang('tickets_title'), "trim|required");
$this->form_validation->set_rules('department_id', lang('tickets_department_id'), "trim|required");
$this->form_validation->set_rules('ticket_status_id', lang('tickets_ticket_status_id'), "trim|required");
$this->form_validation->set_rules('client_id', lang('tickets_client_id'), "trim|required");
$this->form_validation->set_rules('content', lang('tickets_content'), "trim|required");
$this->form_validation->set_rules('datetime', lang('tickets_datetime'), "trim|required");
$this->form_validation->set_rules('logo', lang('branches_logo'), "callback_file[logo," . $required . "]");
}