本文整理汇总了PHP中CI_Lang::line方法的典型用法代码示例。如果您正苦于以下问题:PHP CI_Lang::line方法的具体用法?PHP CI_Lang::line怎么用?PHP CI_Lang::line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CI_Lang
的用法示例。
在下文中一共展示了CI_Lang::line方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: line
/**
* Fetch a single line of text from the language array
*
* @access public
* @param string $line the language line
* @return string
*/
public function line($line = '')
{
$value = parent::line($line);
if ($value === FALSE) {
return $line;
}
return $value;
}
示例2: line
public function line()
{
$line = func_get_arg(0);
$text = parent::line($line);
if (func_num_args() > 1 and preg_match('/\\%/', $text)) {
$args = func_get_args();
array_shift($args);
$text = vsprintf($text, $args);
}
return $text;
}
示例3: line
function line($line, $params = null)
{
$return = parent::line($line);
if ($return === false) {
return "<em>{$line}</em>";
} else {
if (!is_null($params)) {
$return = $this->_ni_line($return, $params);
}
return $return;
}
}
示例4: line
function line($line, $params = null)
{
$return = parent::line($line);
if ($return === false) {
return str_replace('_', ' ', $line);
} else {
if (!is_null($params)) {
$return = $this->_ni_line($return, $params);
}
return $return;
}
}
示例5: line
function line($line = '')
{
if (!$this->CI) {
$this->CI =& get_instance();
$this->CI->load->model('lang_model');
$this->lang_model = $this->CI->lang_model;
}
$lang = get_lang();
$l = $this->lang_model->line($line, $lang);
if ($l != $line) {
// If we found the line in the database
return $l;
}
return parent::line($line, $lang);
// Fallback to CI's default
}
示例6: forgetpassword
/**
* Ajax : Send the password by e-mail to a user requesting it
* POST: string login Login of the user
* RETURN: UNKNOWN if the login was not found, OK otherwise
* @author Benjamin BALET <benjamin.balet@gmail.com>
*/
public function forgetpassword()
{
$this->output->set_content_type('text/plain');
$login = $this->input->post('login');
$this->load->model('users_model');
$user = $this->users_model->getUserByLogin($login);
if (is_null($user)) {
echo "UNKNOWN";
} else {
//We need to instance an different object as the languages of connected user may differ from the UI lang
$lang_mail = new CI_Lang();
$usr_lang = $this->polyglot->code2language($user->language);
$lang_mail->load('email', $usr_lang);
$lang_mail->load('global', $usr_lang);
//Generate random password and store its hash into db
$password = $this->users_model->resetClearPassword($user->id);
//Prepare the e-mail content by parsing a view
$this->load->library('parser');
$data = array('Title' => $lang_mail->line('email_password_forgotten_title'), 'BaseURL' => base_url(), 'Firstname' => $user->firstname, 'Lastname' => $user->lastname, 'Login' => $user->login, 'Password' => $password);
$message = $this->parser->parse('emails/' . $user->language . '/password_forgotten', $data, TRUE);
//Send the e-mail
sendMailByWrapper($this, $lang_mail->line('email_password_forgotten_subject'), $message, $user->email);
//Tell to the frontend that we've found the login and sent the email
echo "OK";
}
}
示例7: sendMail
private function sendMail($id)
{
$this->load->model('users_model');
$this->load->model('delegations_model');
$manager = $this->users_model->getUsers($this->session->userdata('manager'));
if (empty($manager['email'])) {
$this->session->set_flashdata('msg', lang('extra_create_msg_error'));
} else {
$acceptUrl = base_url() . 'overtime/accept/' . $id;
$rejectUrl = base_url() . 'overtime/reject/' . $id;
$this->load->library('email');
$this->load->library('polyglot');
$usr_lang = $this->polyglot->code2language($manager['language']);
$lang_mail = new CI_Lang();
$lang_mail->load('email', $usr_lang);
$lang_mail->load('global', $usr_lang);
$date = new DateTime($this->input->post('date'));
$startdate = $date->format($lang_mail->line('global_date_format'));
$this->load->library('parser');
$data = array('Title' => $lang_mail->line('email_extra_request_validation_title'), 'Firstname' => $this->session->userdata('firstname'), 'Lastname' => $this->session->userdata('lastname'), 'Date' => $startdate, 'Duration' => $this->input->post('duration'), 'Cause' => $this->input->post('cause'), 'UrlAccept' => $acceptUrl, 'UrlReject' => $rejectUrl);
$message = $this->parser->parse('emails/' . $manager['language'] . '/overtime', $data, TRUE);
$this->email->set_encoding('quoted-printable');
if ($this->config->item('from_mail') != FALSE && $this->config->item('from_name') != FALSE) {
$this->email->from($this->config->item('from_mail'), $this->config->item('from_name'));
} else {
$this->email->from('do.not@reply.me', 'LMS');
}
$this->email->to($manager['email']);
if ($this->config->item('subject_prefix') != FALSE) {
$subject = $this->config->item('subject_prefix');
} else {
$subject = '[Jorani] ';
}
$delegates = $this->delegations_model->listMailsOfDelegates($manager['id']);
if ($delegates != '') {
$this->email->cc($delegates);
}
$this->email->subject($subject . $lang_mail->line('email_extra_request_reject_subject') . ' ' . $this->session->userdata('firstname') . ' ' . $this->session->userdata('lastname'));
$this->email->message($message);
$this->email->send();
}
}
示例8: sendMail
/**
* Send a leave request email to the employee that requested the leave
* The method will check if the leave request wes accepted or rejected
* before sending the e-mail
* @param int $id Leave request identifier
* @author Benjamin BALET <benjamin.balet@gmail.com>
*/
private function sendMail($id)
{
$this->load->model('users_model');
$this->load->model('organization_model');
$leave = $this->leaves_model->get_leave_details($id);
//Load details about the employee (manager, supervisor of entity)
$supervisor = $this->organization_model->get_supervisor($leave['organization']);
//Send an e-mail to the employee
$this->load->library('email');
$this->load->library('polyglot');
$usr_lang = $this->polyglot->code2language($leave['language']);
//We need to instance an different object as the languages of connected user may differ from the UI lang
$lang_mail = new CI_Lang();
$lang_mail->load('email', $usr_lang);
$lang_mail->load('global', $usr_lang);
$date = new DateTime($leave['startdate']);
$startdate = $date->format($lang_mail->line('global_date_format'));
$date = new DateTime($leave['enddate']);
$enddate = $date->format($lang_mail->line('global_date_format'));
$this->load->library('parser');
$data = array('Title' => $lang_mail->line('email_leave_request_validation_title'), 'Firstname' => $leave['firstname'], 'Lastname' => $leave['lastname'], 'StartDate' => $startdate, 'EndDate' => $enddate, 'StartDateType' => $lang_mail->line($leave['startdatetype']), 'EndDateType' => $lang_mail->line($leave['enddatetype']), 'Cause' => $leave['cause'], 'Type' => $leave['type']);
$message = "";
if ($this->config->item('subject_prefix') != FALSE) {
$subject = $this->config->item('subject_prefix');
} else {
$subject = '[Jorani] ';
}
if ($leave['status'] == 3) {
$message = $this->parser->parse('emails/' . $leave['language'] . '/request_accepted', $data, TRUE);
$this->email->subject($subject . $lang_mail->line('email_leave_request_accept_subject'));
} else {
$message = $this->parser->parse('emails/' . $leave['language'] . '/request_rejected', $data, TRUE);
$this->email->subject($subject . $lang_mail->line('email_leave_request_reject_subject'));
}
$this->email->set_encoding('quoted-printable');
if ($this->config->item('from_mail') != FALSE && $this->config->item('from_name') != FALSE) {
$this->email->from($this->config->item('from_mail'), $this->config->item('from_name'));
} else {
$this->email->from('do.not@reply.me', 'LMS');
}
$this->email->to($leave['email']);
if (!is_null($supervisor)) {
$this->email->cc($supervisor->email);
}
$this->email->message($message);
$this->email->send();
}
示例9: sendMail
/**
* Send a leave request email to the manager of the connected employee
* @param int $id Leave request identifier
* @author Benjamin BALET <benjamin.balet@gmail.com>
*/
private function sendMail($id)
{
$this->load->model('users_model');
$this->load->model('types_model');
$this->load->model('delegations_model');
//We load everything from DB as the LR can be edited from HR/Employees
$leave = $this->leaves_model->getLeaves($id);
$user = $this->users_model->getUsers($leave['employee']);
$manager = $this->users_model->getUsers($user['manager']);
//Test if the manager hasn't been deleted meanwhile
if (empty($manager['email'])) {
$this->session->set_flashdata('msg', lang('leaves_create_flash_msg_error'));
} else {
//Send an e-mail to the manager
$this->load->library('email');
$this->load->library('polyglot');
$usr_lang = $this->polyglot->code2language($manager['language']);
//We need to instance an different object as the languages of connected user may differ from the UI lang
$lang_mail = new CI_Lang();
$lang_mail->load('email', $usr_lang);
$lang_mail->load('global', $usr_lang);
$date = new DateTime($leave['startdate']);
$startdate = $date->format($lang_mail->line('global_date_format'));
$date = new DateTime($leave['enddate']);
$enddate = $date->format($lang_mail->line('global_date_format'));
$this->load->library('parser');
$data = array('Title' => $lang_mail->line('email_leave_request_title'), 'Firstname' => $user['firstname'], 'Lastname' => $user['lastname'], 'StartDate' => $startdate, 'EndDate' => $enddate, 'StartDateType' => $lang_mail->line($leave['startdatetype']), 'EndDateType' => $lang_mail->line($leave['enddatetype']), 'Type' => $this->types_model->getName($leave['type']), 'Duration' => $leave['duration'], 'Balance' => $this->leaves_model->getLeavesTypeBalanceForEmployee($leave['employee'], $leave['type_name'], $leave['startdate']), 'Reason' => $leave['cause'], 'BaseUrl' => $this->config->base_url(), 'LeaveId' => $id, 'UserId' => $this->user_id);
$message = $this->parser->parse('emails/' . $manager['language'] . '/request', $data, TRUE);
$this->email->set_encoding('quoted-printable');
if ($this->config->item('from_mail') != FALSE && $this->config->item('from_name') != FALSE) {
$this->email->from($this->config->item('from_mail'), $this->config->item('from_name'));
} else {
$this->email->from('do.not@reply.me', 'LMS');
}
$this->email->to($manager['email']);
if ($this->config->item('subject_prefix') != FALSE) {
$subject = $this->config->item('subject_prefix');
} else {
$subject = '[Jorani] ';
}
//Copy to the delegates, if any
$delegates = $this->delegations_model->listMailsOfDelegates($manager['id']);
if ($delegates != '') {
$this->email->cc($delegates);
}
$this->email->subject($subject . $lang_mail->line('email_leave_request_subject') . ' ' . $this->session->userdata('firstname') . ' ' . $this->session->userdata('lastname'));
$this->email->message($message);
$this->email->send();
}
}
示例10: line
/**
* Fetch a single line of text from the language array
*
* @access public
* @param string $line the language line
* @return string
*/
public function line($line = '', $params = FALSE)
{
if ($params !== FALSE || FALSE === ($value = parent::line($line))) {
$value = $this->_trans($line, $params);
}
return $value ? $value : $line;
}
示例11: sendMail
/**
* Send a overtime request email to the manager of the connected employee
* @param int $id Leave request identifier
* @author Benjamin BALET <benjamin.balet@gmail.com>
*/
private function sendMail($id)
{
$this->load->model('users_model');
$this->load->model('delegations_model');
$manager = $this->users_model->get_users($this->session->userdata('manager'));
//Test if the manager hasn't been deleted meanwhile
if (empty($manager['email'])) {
$this->session->set_flashdata('msg', lang('extra_create_msg_error'));
} else {
$acceptUrl = base_url() . 'overtime/accept/' . $id;
$rejectUrl = base_url() . 'overtime/reject/' . $id;
//Send an e-mail to the manager
$this->load->library('email');
$this->load->library('polyglot');
$usr_lang = $this->polyglot->code2language($manager['language']);
//We need to instance an different object as the languages of connected user may differ from the UI lang
$lang_mail = new CI_Lang();
$lang_mail->load('email', $usr_lang);
$lang_mail->load('global', $usr_lang);
$date = new DateTime($this->input->post('date'));
$startdate = $date->format($lang_mail->line('global_date_format'));
$this->load->library('parser');
$data = array('Title' => $lang_mail->line('email_extra_request_validation_title'), 'Firstname' => $this->session->userdata('firstname'), 'Lastname' => $this->session->userdata('lastname'), 'Date' => $startdate, 'Duration' => $this->input->post('duration'), 'Cause' => $this->input->post('cause'), 'UrlAccept' => $acceptUrl, 'UrlReject' => $rejectUrl);
$message = $this->parser->parse('emails/' . $manager['language'] . '/overtime', $data, TRUE);
if ($this->email->mailer_engine == 'phpmailer') {
$this->email->phpmailer->Encoding = 'quoted-printable';
}
if ($this->config->item('from_mail') != FALSE && $this->config->item('from_name') != FALSE) {
$this->email->from($this->config->item('from_mail'), $this->config->item('from_name'));
} else {
$this->email->from('do.not@reply.me', 'LMS');
}
$this->email->to($manager['email']);
if ($this->config->item('subject_prefix') != FALSE) {
$subject = $this->config->item('subject_prefix');
} else {
$subject = '[Jorani] ';
}
//Copy to the delegates, if any
$delegates = $this->delegations_model->get_delegates_mails($manager['id']);
if ($delegates != '') {
$this->email->cc($delegates);
}
$this->email->subject($subject . $lang_mail->line('email_extra_request_reject_subject') . $this->session->userdata('firstname') . ' ' . $this->session->userdata('lastname'));
$this->email->message($message);
$this->email->send();
}
}
示例12: forgetpassword
public function forgetpassword()
{
$this->output->set_content_type('text/plain');
$login = $this->input->post('login');
$this->load->model('users_model');
$user = $this->users_model->getUserByLogin($login);
if (is_null($user)) {
echo "UNKNOWN";
} else {
$lang_mail = new CI_Lang();
$usr_lang = $this->polyglot->code2language($user->language);
$lang_mail->load('email', $usr_lang);
$lang_mail->load('global', $usr_lang);
$password = $this->users_model->resetClearPassword($user->id);
$this->load->library('parser');
$data = array('Title' => $lang_mail->line('email_password_forgotten_title'), 'BaseURL' => base_url(), 'Firstname' => $user->firstname, 'Lastname' => $user->lastname, 'Login' => $user->login, 'Password' => $password);
$message = $this->parser->parse('emails/' . $user->language . '/password_forgotten', $data, TRUE);
sendMailByWrapper($this, $lang_mail->line('email_password_forgotten_subject'), $message, $user->email);
echo "OK";
}
}
示例13: forgetpassword
/**
* Send the password by e-mail to a user requesting it
*/
public function forgetpassword()
{
expires_now();
$this->output->set_content_type('text/plain');
$login = $this->input->post('login');
$this->load->model('users_model');
$user = $this->users_model->getUserByLogin($login);
if (is_null($user)) {
echo "UNKNOWN";
} else {
//Send an email to the user with its login information
$this->load->library('email');
//We need to instance an different object as the languages of connected user may differ from the UI lang
$lang_mail = new CI_Lang();
$usr_lang = $this->polyglot->code2language($user->language);
$lang_mail->load('email', $usr_lang);
$lang_mail->load('global', $usr_lang);
//Generate random password and store its hash into db
$password = $this->users_model->resetClearPassword($user->id);
//Send an e-mail to the user requesting a new password
$this->load->library('parser');
$data = array('Title' => $lang_mail->line('email_password_forgotten_title'), 'BaseURL' => base_url(), 'Firstname' => $user->firstname, 'Lastname' => $user->lastname, 'Login' => $user->login, 'Password' => $password);
$message = $this->parser->parse('emails/' . $user->language . '/password_forgotten', $data, TRUE);
$this->email->set_encoding('quoted-printable');
if ($this->config->item('from_mail') != FALSE && $this->config->item('from_name') != FALSE) {
$this->email->from($this->config->item('from_mail'), $this->config->item('from_name'));
} else {
$this->email->from('do.not@reply.me', 'LMS');
}
$this->email->to($user->email);
if ($this->config->item('subject_prefix') != FALSE) {
$subject = $this->config->item('subject_prefix');
} else {
$subject = '[Jorani] ';
}
$this->email->subject($subject . $lang_mail->line('email_password_forgotten_subject'));
$this->email->message($message);
$this->email->send();
echo "OK";
}
}
示例14: sendMail
private function sendMail($id)
{
$this->load->model('users_model');
$this->load->model('organization_model');
$extra = $this->overtime_model->getExtras($id);
$employee = $this->users_model->getUsers($extra['employee']);
$supervisor = $this->organization_model->getSupervisor($employee['organization']);
$this->load->library('email');
$this->load->library('polyglot');
$usr_lang = $this->polyglot->code2language($employee['language']);
$lang_mail = new CI_Lang();
$lang_mail->load('email', $usr_lang);
$lang_mail->load('global', $usr_lang);
$date = new DateTime($extra['date']);
$startdate = $date->format($lang_mail->line('global_date_format'));
$this->load->library('parser');
$data = array('Title' => $lang_mail->line('email_overtime_request_validation_title'), 'Firstname' => $employee['firstname'], 'Lastname' => $employee['lastname'], 'Date' => $startdate, 'Duration' => $extra['duration'], 'Cause' => $extra['cause']);
if ($extra['status'] == 3) {
$message = $this->parser->parse('emails/' . $employee['language'] . '/overtime_accepted', $data, TRUE);
$subject = $lang_mail->line('email_overtime_request_accept_subject');
} else {
$message = $this->parser->parse('emails/' . $employee['language'] . '/overtime_rejected', $data, TRUE);
$subject = $lang_mail->line('email_overtime_request_reject_subject');
}
sendMailByWrapper($this, $subject, $message, $employee['email'], is_null($supervisor) ? NULL : $supervisor->email);
}
示例15: create
/**
* Display the form / action Create a new user
* @author Benjamin BALET <benjamin.balet@gmail.com>
*/
public function create()
{
$this->auth->check_is_granted('create_user');
expires_now();
$data = getUserContext($this);
$this->load->helper('form');
$this->load->library('form_validation');
$this->load->library('polyglot');
$data['title'] = lang('users_create_title');
$data['help'] = $this->help->create_help_link('global_link_doc_page_create_user');
$this->load->model('roles_model');
$data['roles'] = $this->roles_model->get_roles();
$this->load->model('contracts_model');
$data['contracts'] = $this->contracts_model->get_contracts();
$data['public_key'] = file_get_contents('./assets/keys/public.pem', true);
$this->form_validation->set_rules('firstname', lang('users_create_field_firstname'), 'required|xss_clean|strip_tags');
$this->form_validation->set_rules('lastname', lang('users_create_field_lastname'), 'required|xss_clean|strip_tags');
$this->form_validation->set_rules('login', lang('users_create_field_login'), 'required|callback_login_check|xss_clean|strip_tags');
$this->form_validation->set_rules('email', lang('users_create_field_email'), 'required|xss_clean|strip_tags');
if (!$this->config->item('ldap_enabled')) {
$this->form_validation->set_rules('CipheredValue', lang('users_create_field_password'), 'required');
}
$this->form_validation->set_rules('role[]', lang('users_create_field_role'), 'required|xss_clean|strip_tags');
$this->form_validation->set_rules('manager', lang('users_create_field_manager'), 'required|xss_clean|strip_tags');
$this->form_validation->set_rules('contract', lang('users_create_field_contract'), 'xss_clean|strip_tags');
$this->form_validation->set_rules('position', lang('users_create_field_position'), 'xss_clean|strip_tags');
$this->form_validation->set_rules('entity', lang('users_create_field_entity'), 'xss_clean|strip_tags');
$this->form_validation->set_rules('datehired', lang('users_create_field_hired'), 'xss_clean|strip_tags');
$this->form_validation->set_rules('identifier', lang('users_create_field_identifier'), 'xss_clean|strip_tags');
$this->form_validation->set_rules('language', lang('users_create_field_language'), 'xss_clean|strip_tags');
$this->form_validation->set_rules('timezone', lang('users_create_field_timezone'), 'xss_clean|strip_tags');
if ($this->config->item('ldap_basedn_db')) {
$this->form_validation->set_rules('ldap_path', lang('users_create_field_ldap_path'), 'xss_clean|strip_tags');
}
if ($this->form_validation->run() === FALSE) {
$this->load->view('templates/header', $data);
$this->load->view('menu/index', $data);
$this->load->view('users/create', $data);
$this->load->view('templates/footer');
} else {
$password = $this->users_model->set_users();
log_message('info', 'User ' . $this->input->post('login') . ' has been created by user #' . $this->session->userdata('id'));
//Send an e-mail to the user so as to inform that its account has been created
$this->load->library('email');
$usr_lang = $this->polyglot->code2language($this->input->post('language'));
//We need to instance an different object as the languages of connected user may differ from the UI lang
$lang_mail = new CI_Lang();
$lang_mail->load('email', $usr_lang);
$this->load->library('parser');
$data = array('Title' => $lang_mail->line('email_user_create_title'), 'BaseURL' => base_url(), 'Firstname' => $this->input->post('firstname'), 'Lastname' => $this->input->post('lastname'), 'Login' => $this->input->post('login'), 'Password' => $password);
$message = $this->parser->parse('emails/' . $this->input->post('language') . '/new_user', $data, TRUE);
if ($this->email->mailer_engine == 'phpmailer') {
$this->email->phpmailer->Encoding = 'quoted-printable';
}
if ($this->config->item('from_mail') != FALSE && $this->config->item('from_name') != FALSE) {
$this->email->from($this->config->item('from_mail'), $this->config->item('from_name'));
} else {
$this->email->from('do.not@reply.me', 'LMS');
}
$this->email->to($this->input->post('email'));
if ($this->config->item('subject_prefix') != FALSE) {
$subject = $this->config->item('subject_prefix');
} else {
$subject = '[Jorani] ';
}
$this->email->subject($subject . $lang_mail->line('email_user_create_subject'));
$this->email->message($message);
$this->email->send();
$this->session->set_flashdata('msg', lang('users_create_flash_msg_success'));
redirect('users');
}
}