コード例 #1
0
ファイル: tickets.php プロジェクト: roncodes/bitsy-crm
 public function view($id = NULL)
 {
     $settings = $this->data['settings'] = $this->settings->get_settings();
     $user = $this->data['user'] = $this->ion_auth->get_user(user_id());
     $ticket = $this->data['ticket'] = $this->core->get_ticket($id);
     $replies = $this->data['replies'] = $this->core->get_ticket_replies($ticket->code);
     $client = $this->data['client'] = $this->ion_auth->get_user($ticket->client);
     if (isset($_POST['reply'])) {
         // Quick and dirty - reply
         $this->form_validation->set_rules('reply', 'Reply', 'required|trim|xss_clean');
         if ($this->form_validation->run() == TRUE) {
             if (count($replies) == 0) {
                 $subject = $ticket->subject;
             } else {
                 $subject = $replies[count($replies) - 1]->subject;
             }
             $query = $this->db->query("INSERT INTO tickets (code, subject, issue, client, project, status, reply) VALUES ('{$ticket->code}', 'RE: {$subject}', '<b>{$user->username} (admin) says:</b> " . mysql_real_escape_string($_POST['reply']) . "', '{$ticket->client}', '{$ticket->project}', 'Open', 1)");
             if ($query) {
                 // Send Email
                 $email_data['user'] = $user->username;
                 $email_data['reply'] = '<b>' . $user->username . ' (admin) says:</b> ' . $_POST['reply'];
                 $email_data['ticket_id'] = $ticket->ticket_id;
                 $email_data['ticket_subject'] = 'RE: ' . $subject;
                 $this->email->from($settings['company_email'], $settings['site_name']);
                 $this->email->to($client->email);
                 $this->email->subject('New Reply On Your Ticket');
                 $this->email->message($this->load->view('emails/ticket_reply', $email_data, true));
                 $this->email->send();
                 flashmsg('New reply successfully added to ticket', 'success');
                 redirect('/admin/tickets/view/' . $id);
             }
         }
     }
 }
コード例 #2
0
 public function index()
 {
     $data = array();
     $this->load->model(array('questionnaires_model', 'recently_viewed_questionnaires_model'));
     // Check for any previous message
     if ($this->session->flashdata('message_content')) {
         $data['severity'] = $this->session->flashdata('message_severity') ? $this->session->flashdata('message_severity') : 'info';
         $data['message'] = $this->session->flashdata('message_content');
     }
     // Load data for tables
     $data['recently_returned_table'] = $this->questionnaires_model->recently_returned_table();
     $data['recently_viewed_table'] = $this->recently_viewed_questionnaires_model->recently_viewed_table(user_id());
     $data['questionnaires_table'] = $this->questionnaires_model->questionnaires_table();
     // Load Chart.js resources
     $this->layout->add_script('/assets/js/chartJs/chart.min.js');
     // Load Moment.js and Relative Time resources
     $this->layout->add_script('/assets/js/momentJs/moment.min.js');
     $this->layout->add_script('/assets/js/relativeTime.js');
     // Load Peity resources
     $this->layout->add_script('/assets/js/peity/jquery.peity.min.js');
     // Load DataTables resources
     $this->layout->add_stylesheet('/assets/css/dataTables/dataTables.bootstrap.css');
     $this->layout->add_script('/assets/js/dataTables/jquery.dataTables.js');
     $this->layout->add_script('/assets/js/dataTables/dataTables.bootstrap.js');
     // General dashboard style and script
     $this->layout->add_stylesheet('/assets/css/dashboard.css');
     $this->layout->add_script('/assets/js/dashboard.js');
     // Load the view
     $this->layout->set_page_title('Dashboard');
     $this->layout->view('dashboard/home', $data);
 }
コード例 #3
0
 public function saveRiwayatPendidikan($post)
 {
     if ($post) {
         $this->db->trans_begin();
         $this->db->set('NIP', $post['nip']);
         $this->db->set('TINGKAT_PENDIDIKAN_ID', $post['tingkat_pendidikan']);
         $this->db->set('PENDIDIKAN_ID', $post['nama_pendidikan']);
         $this->db->set('TANGGAL_LULUS', mysql_date($post['tanggal_lulus']));
         $this->db->set('TAHUN_LULUS', $post['tahun_lulus']);
         $this->db->set('NOMOR_IJAZAH', $post['nomor_ijazah']);
         $this->db->set('NAMA_SEKOLAH', $post['nama_sekolah']);
         $this->db->set('GELAR_DEPAN', $post['gelar_depan']);
         $this->db->set('GELAR_BELAKANG', $post['gelar_belakang']);
         $this->db->set('STATUS_PENDIDIKAN', $post['status_pendidikan']);
         if (!empty($post['riwayat_pendidikan_id'])) {
             $this->db->set('USERUPDATE', user_id());
             $this->db->set('UPDATEDATE', 'NOW()', FALSE);
             $this->db->where('RIWAYAT_PENDIDIKAN_ID', $post['riwayat_pendidikan_id']);
             $this->db->update('sp_riwayat_pendidikan');
         } else {
             $this->db->set('USERINSERT', user_id());
             $this->db->set('INSERTDATE', 'NOW()', FALSE);
             $this->db->insert('sp_riwayat_pendidikan');
         }
         if ($this->db->trans_status() === FALSE) {
             $this->db->trans_rollback();
             $success = FALSE;
         } else {
             $this->db->trans_commit();
             $success = TRUE;
         }
         return $success;
     }
 }
コード例 #4
0
 public function saveRiwayatPenghargaan($post)
 {
     if ($post) {
         $this->db->trans_begin();
         $this->db->set('NIP', $post['nip']);
         $this->db->set('PENGHARGAAN_ID', $post['jenis_penghargaan_id']);
         $this->db->set('TANGGAL_SK', mysql_date($post['penghargaan_tgl_sk']));
         $this->db->set('NOMOR_SK', $post['penghargaan_no_sk']);
         if (!empty($post['riwayat_penghargaan_id'])) {
             $this->db->set('USERUPDATE', user_id());
             $this->db->set('UPDATEDATE', 'NOW()', FALSE);
             $this->db->where('RIWAYAT_PENGHARGAAN_ID', $post['riwayat_penghargaan_id']);
             $this->db->update('sp_riwayat_penghargaan');
         } else {
             $this->db->set('USERINSERT', user_id());
             $this->db->set('INSERTDATE', 'NOW()', FALSE);
             $this->db->insert('sp_riwayat_penghargaan');
         }
         if ($this->db->trans_status() === FALSE) {
             $this->db->trans_rollback();
             $success = FALSE;
         } else {
             $this->db->trans_commit();
             $success = TRUE;
         }
         return $success;
     }
 }
コード例 #5
0
ファイル: scoring_model.php プロジェクト: AlvaCorp/maxon
 function save($data)
 {
     $app_id = $data['app_id'];
     if ($q = $this->db->query("select a.cust_id,c.cust_name,c.phone \n\t\t\tfrom ls_app_master a left join ls_cust_master c\n\t\t\ton a.cust_id=c.cust_id where a.app_id='" . $app_id . "'")) {
         if ($row = $q->row()) {
             $data['cust_id'] = $row->cust_id;
             $data['cust_name'] = $row->cust_name;
             $data['phone'] = $row->phone;
         }
     }
     $score = 0;
     foreach ($data as $key => $value) {
         if ($value == "1") {
             $score++;
         }
     }
     $score = round($score / 14 * 100);
     $ok = $this->db->insert($this->table_name, $data);
     if ($ok) {
         if ($score > 75) {
             $this->db->where("app_id", $app_id)->update("ls_app_master", array("scored" => 1, "score_value" => $score, "status" => "Wait Review"));
         } else {
             //masuk inbox sa nomor SPK ditolak
             $message = "Nomor SPK {$app_id} tidak memenuhi syarat score value = {$score}";
             $to = $this->db->select("create_by")->where("app_id", $app_id)->get("ls_app_master")->row()->create_by;
             inbox_send(user_id(), $to, "Not Recomended", $message);
             $this->db->where("app_id", $app_id)->update("ls_app_master", array("scored" => 1, "score_value" => $score, "status" => "Not Recomended"));
         }
     }
     return $ok;
 }
コード例 #6
0
ファイル: lib_location.php プロジェクト: rcrowley/wheresmycar
function location_impossible($user_id = false)
{
    if (!$user_id) {
        $user_id = user_id();
    }
    db_query("UPDATE users SET impossible = '1', sweep_ts = NULL\n\t\tWHERE id = '" . (int) $user_id . "';");
}
コード例 #7
0
ファイル: frontend.php プロジェクト: roncodes/bitsy-crm
 public function index()
 {
     $this->data['invoices'] = $this->core->get_recent_client_invoices(user_id());
     $this->data['projects'] = $this->core->get_recent_client_projects(user_id());
     $this->data['user'] = $this->ion_auth->get_user(user_id());
     $this->data['meta_title'] = 'Clients Manager';
 }
コード例 #8
0
 public function createAccountContactInformation()
 {
     $this->accessNumber = 1;
     if ($this->checkACL()) {
         $this->form_validation->set_rules('type', 'Contact Information Type', 'required');
         $this->form_validation->set_rules('detail', 'Detail', 'required');
         if ($this->form_validation->run()) {
             $result = $this->m_account_contact_information->createAccountContactInformation(user_id(), $this->input->post("type"), $this->input->post("detail"));
             if ($result) {
                 $this->actionLog($result);
                 $this->responseData($result);
             } else {
                 $this->responseError(3, "Failed to create");
             }
         } else {
             if (count($this->form_validation->error_array())) {
                 $this->responseError(102, $this->form_validation->error_array());
             } else {
                 $this->responseError(4, "Required Fields are empty");
             }
         }
     } else {
         $this->responseError(1, "Not Authorized");
     }
     $this->outputResponse();
 }
コード例 #9
0
ファイル: projects.php プロジェクト: roncodes/bitsy-crm
 public function comment($id = NULL)
 {
     $settings = $this->data['settings'] = $this->settings->get_settings();
     $user = $this->data['user'] = $this->ion_auth->get_user(user_id());
     $project = $this->data['project'] = $this->core->get_project($id);
     if ($project->client != $user->id) {
         flashmsg('Project does not exist', 'error');
         redirect('client/projects');
     }
     if (isset($_POST['new_update'])) {
         // Quick and dirty - add a new update
         $this->form_validation->set_rules('title', 'Comment Title', 'required|trim|xss_clean');
         $this->form_validation->set_rules('description', 'Comment Description', 'required|trim|xss_clean');
         if ($this->form_validation->run() == TRUE) {
             $query = $this->db->query("INSERT INTO project_updates (project_id, title, description) VALUES ('{$project->id}', 'Comment by Client: {$_POST['title']}', '{$_POST['description']}')");
             if ($query) {
                 // Send Email
                 $email_data['user'] = $user->username;
                 $email_data['project_name'] = $project->name;
                 foreach ($this->core->get_admin_emails() as $email) {
                     $this->email->from($settings['company_email'], $settings['site_name']);
                     $this->email->to($email);
                     $this->email->subject('New Comment on Project');
                     $this->email->message($this->load->view('emails/project_comment', $email_data, true));
                     $this->email->send();
                 }
                 flashmsg('Project Comment added successfully to ' . $project->name . '.', 'success');
                 redirect('/client/projects/comment/' . $id);
             }
         }
     }
     $this->data['updates'] = $this->core->get_updates($id);
     $this->data['meta_title'] = 'Comment on Project';
 }
コード例 #10
0
ファイル: adminuser.php プロジェクト: RazorMarx/izend
function adminuser($lang, $arglist = false)
{
    if (!user_has_role('administrator')) {
        return run('error/unauthorized', $lang);
    }
    $user_id = false;
    if (is_array($arglist)) {
        if (isset($arglist[0])) {
            $user_id = $arglist[0];
        }
    }
    if (!$user_id) {
        return run('error/notfound', $lang);
    }
    $user_id = user_id($user_id);
    if (!$user_id) {
        return run('error/notfound', $lang);
    }
    $useredit = build('useredit', $lang, $user_id);
    if ($useredit === false) {
        return redirect('admin', $lang);
    }
    head('title', translate('admin:title', $lang));
    head('description', false);
    head('keywords', false);
    head('robots', 'noindex, nofollow');
    $admin = true;
    $banner = build('banner', $lang, compact('admin'));
    $content = view('adminuser', $lang, compact('useredit'));
    $output = layout('standard', compact('banner', 'content'));
    return $output;
}
コード例 #11
0
 /**
  * Display the specified resource.
  *
  * @param Request $request
  *
  * @return Response
  */
 public function store(MessageUserRequest $request)
 {
     try {
         $mails = $request->get('mails');
         $attributes = $request->all();
         $attributes['user_id'] = user_id('web');
         $attributes['user_type'] = user_type();
         $attributes['name'] = user()->name;
         $attributes['from'] = user()->email;
         $attributes['to'] = implode(",", $mails);
         $attributes['status'] = $request->get('status');
         $message = $this->repository->create($attributes);
         if ($request->get('status') == 'Sent') {
             foreach ($mails as $mail) {
                 $attributes['status'] = "Inbox";
                 $message1 = $this->repository->create($attributes);
             }
         }
         $sent_count = $this->repository->msgCount('Sent');
         $inbox_count = $this->repository->msgCount('Inbox');
         return response()->json(['message' => trans('messages.success.updated', ['Module' => trans('message::message.name')]), 'code' => 204, 'redirect' => trans_url('/user/message/message/' . $message->getRouteKey()), 'sent_count' => $sent_count, 'inbox_count' => $inbox_count], 201);
     } catch (Exception $e) {
         return response()->json(['message' => $e->getMessage(), 'code' => 400], 400);
     }
 }
コード例 #12
0
ファイル: profile.php プロジェクト: roncodes/bitsy-crm
 public function index()
 {
     $user = $this->data['user'] = $this->ion_auth->get_user(user_id());
     if (isset($_POST['update_password'])) {
         $this->form_validation->set_rules('old_password', 'Old Password', 'required');
         $this->form_validation->set_rules('new_password', 'Password', 'min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[new_password_confirm]|trim|xss_clean');
         $this->form_validation->set_rules('new_password_confirm', 'Password Confirmation', 'trim|xss_clean');
         if ($this->form_validation->run() === TRUE) {
             if ($this->ion_auth->change_password($user->email, $_POST['old_password'], $_POST['new_password'])) {
                 flashmsg('Your password has been updated successfully.', 'success');
                 redirect('/client/profile');
             } else {
                 flashmsg('Your password failed to be updated.', 'error');
                 redirect('/client/profile');
             }
         }
     }
     $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
     if ($this->form_validation->run() === TRUE) {
         $this->ion_auth->update_user(user_id(), array('email' => $_POST['email'], 'first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'company' => $_POST['company'], 'phone' => $_POST['phone'], 'address' => $_POST['address'], 'timezone' => $_POST['timezone']));
         flashmsg('Your profile has been updated successfully.', 'success');
         redirect('/client/profile');
     }
     $timezones = array('America/Phoenix', 'America/Adak', 'America/Anchorage', 'America/Anguilla', 'America/Antigua', 'America/Araguaina', 'America/Argentina/Buenos_Aires', 'America/Argentina/Catamarca', 'America/Argentina/ComodRivadavia', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/La_Rioja', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Salta', 'America/Argentina/San_Juan', 'America/Argentina/San_Luis', 'America/Argentina/Tucuman', 'America/Argentina/Ushuaia', 'America/Aruba', 'America/Asuncion', 'America/Atikokan', 'America/Atka', 'America/Bahia', 'America/Bahia_Banderas', 'America/Barbados', 'America/Belem', 'America/Belize', 'America/Blanc-Sablon', 'America/Boa_Vista', 'America/Bogota', 'America/Boise', 'America/Buenos_Aires', 'America/Cambridge_Bay', 'America/Campo_Grande', 'America/Cancun', 'America/Caracas', 'America/Catamarca', 'America/Cayenne', 'America/Cayman', 'America/Chicago', 'America/Chihuahua', 'America/Coral_Harbour', 'America/Cordoba', 'America/Costa_Rica', 'America/Creston', 'America/Cuiaba', 'America/Curacao', 'America/Danmarkshavn', 'America/Dawson', 'America/Dawson_Creek', 'America/Denver', 'America/Detroit', 'America/Dominica', 'America/Edmonton', 'America/Eirunepe', 'America/El_Salvador', 'America/Ensenada', 'America/Fort_Wayne', 'America/Fortaleza', 'America/Glace_Bay', 'America/Godthab', 'America/Goose_Bay', 'America/Grand_Turk', 'America/Grenada', 'America/Guadeloupe', 'America/Guatemala', 'America/Guayaquil', 'America/Guyana', 'America/Halifax', 'America/Havana', 'America/Hermosillo', 'America/Indiana/Indianapolis', 'America/Indiana/Knox', 'America/Indiana/Marengo', 'America/Indiana/Petersburg', 'America/Indiana/Tell_City', 'America/Indiana/Vevay', 'America/Indiana/Vincennes', 'America/Indiana/Winamac', 'America/Indianapolis', 'America/Inuvik', 'America/Iqaluit', 'America/Jamaica', 'America/Jujuy', 'America/Juneau', 'America/Kentucky/Louisville', 'America/Kentucky/Monticello', 'America/Knox_IN', 'America/Kralendijk', 'America/La_Paz', 'America/Lima', 'America/Los_Angeles', 'America/Louisville', 'America/Lower_Princes', 'America/Maceio', 'America/Managua', 'America/Manaus', 'America/Marigot', 'America/Martinique', 'America/Matamoros', 'America/Mazatlan', 'America/Mendoza', 'America/Menominee', 'America/Merida', 'America/Metlakatla', 'America/Mexico_City', 'America/Miquelon', 'America/Moncton', 'America/Monterrey', 'America/Montevideo', 'America/Montreal', 'America/Montserrat', 'America/Nassau', 'America/New_York', 'America/Nipigon', 'America/Nome', 'America/Noronha', 'America/North_Dakota/Beulah', 'America/North_Dakota/Center', 'America/North_Dakota/New_Salem', 'America/Ojinaga', 'America/Panama', 'America/Pangnirtung', 'America/Paramaribo', 'America/Phoenix', 'America/Port-au-Prince', 'America/Port_of_Spain', 'America/Porto_Acre', 'America/Porto_Velho', 'America/Puerto_Rico', 'America/Rainy_River', 'America/Rankin_Inlet', 'America/Recife', 'America/Regina', 'America/Resolute', 'America/Rio_Branco', 'America/Rosario', 'America/Santa_Isabel', 'America/Santarem', 'America/Santiago', 'America/Santo_Domingo', 'America/Sao_Paulo', 'America/Scoresbysund', 'America/Shiprock', 'America/Sitka', 'America/St_Barthelemy', 'America/St_Johns', 'America/St_Kitts', 'America/St_Lucia', 'America/St_Thomas', 'America/St_Vincent', 'America/Swift_Current', 'America/Tegucigalpa', 'America/Thule', 'America/Thunder_Bay', 'America/Tijuana', 'America/Toronto', 'America/Tortola', 'America/Vancouver', 'America/Virgin', 'America/Whitehorse', 'America/Winnipeg', 'America/Yakutat', 'America/Yellowknife');
     $this->data['timezones'] = array_combine($timezones, $timezones);
     $this->data['meta_title'] = 'Your Profile';
 }
コード例 #13
0
    /** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        extract($args);
        $widget_title = $instance['widget_title'];
        if (isset($instance['auto_play'])) {
            $auto_play = 'true';
        } else {
            $auto_play = 'false';
        }
        $info = crInstGetInfo(user_id(), access_token());
        echo $before_widget;
        echo $before_title . $widget_title . $after_title;
        echo '<div class="instagram-wrap">';
        echo crInstShowInfo($info, array('website' => true, 'media' => true, 'followers' => true, 'following' => true, 'profile_pic' => true), $this->avatar_width);
        echo crInstShowWidgetData(crInstGetSelfFeed(access_token()), $info, $this->display_photos, $this->item_width, "sIntSelfFeed", $instance['display_caption']);
        echo '</div>';
        ?>
		<script type="text/javascript">
			jQuery(document).ready(function($){
				$("a[data-rel^='sIntSelfFeed']").prettyPhoto({
					hook: 'data-rel',
					autoplay_slideshow: <?php 
        echo $auto_play;
        ?>
,
					social_tools: false
				});
			});
		</script>
<?php 
        echo $after_widget;
    }
コード例 #14
0
 public function saveRiwayatKursus($post)
 {
     if ($post) {
         $this->db->trans_begin();
         $this->db->set('NIP', $post['nip']);
         //$this->db->set('KURSUS_ID', $post['tingkat_pendidikan']);
         $this->db->set('NAMA_KURSUS', $post['nama_kursus']);
         $this->db->set('TANGGAL_KURSUS', mysql_date($post['tanggal_kursus']));
         $this->db->set('JUMLAH_JAM', $post['jumlah_jam']);
         $this->db->set('TAHUN_KURSUS', $post['tahun_kursus']);
         $this->db->set('INSTANSI_ID', $post['instansi']);
         $this->db->set('INSTITUSI_PENYELENGGARA', $post['institusi_penyelenggara']);
         $this->db->set('TIPE_KURSUS', $post['tipe_kursus']);
         $this->db->set('NOMOR_SERTIFIKAT', $post['nomor_sertifikat']);
         if (!empty($post['riwayat_kursus_id'])) {
             $this->db->set('USERUPDATE', user_id());
             $this->db->set('UPDATEDATE', 'NOW()', FALSE);
             $this->db->where('RIWAYAT_KURSUS_ID', $post['riwayat_kursus_id']);
             $this->db->update('sp_riwayat_kursus');
         } else {
             $this->db->set('USERINSERT', user_id());
             $this->db->set('INSERTDATE', 'NOW()', FALSE);
             $this->db->insert('sp_riwayat_kursus');
         }
         if ($this->db->trans_status() === FALSE) {
             $this->db->trans_rollback();
             $success = FALSE;
         } else {
             $this->db->trans_commit();
             $success = TRUE;
         }
         return $success;
     }
 }
コード例 #15
0
 public function saveRiwayatDiklat($post)
 {
     if ($post) {
         $this->db->trans_begin();
         $this->db->set('NIP', $post['nip']);
         $this->db->set('JENIS_DIKLAT_ID', $post['jenis_diklat']);
         $this->db->set('DIKLAT_STRUKTURAL_ID', $post['diklat_struktural']);
         $this->db->set('NAMA_DIKLAT', $post['nama_diklat']);
         $this->db->set('TANGGAL_MULAI', mysql_date($post['tanggal_mulai']));
         $this->db->set('TANGGAL_SELESAI', mysql_date($post['tanggal_selesai']));
         $this->db->set('NOMOR_SERTIFIKAT', $post['no_sertifikat']);
         $this->db->set('JUMLAH_PJL', $post['jumlah_pjl']);
         $this->db->set('PENYELENGGARA', $post['penyelenggara']);
         if (!empty($post['riwayat_diklat_id'])) {
             $this->db->set('USERUPDATE', user_id());
             $this->db->set('UPDATEDATE', 'NOW()', FALSE);
             $this->db->where('RIWAYAT_DIKLAT_ID', $post['riwayat_diklat_id']);
             $this->db->update('sp_riwayat_diklat');
         } else {
             $this->db->set('USERINSERT', user_id());
             $this->db->set('INSERTDATE', 'NOW()', FALSE);
             $this->db->insert('sp_riwayat_diklat');
         }
         if ($this->db->trans_status() === FALSE) {
             $this->db->trans_rollback();
             $success = FALSE;
         } else {
             $this->db->trans_commit();
             $success = TRUE;
         }
         return $success;
     }
 }
コード例 #16
0
function login($email, $password)
{
    if (check_password($email, $password)) {
        return create_session(user_id($email));
    } else {
        return false;
    }
}
コード例 #17
0
ファイル: lib_user.php プロジェクト: rcrowley/wheresmycar
function user_logout()
{
    if ($id = user_id()) {
        db_query("UPDATE users SET hash = NULL WHERE id = '" . (int) $id . "' LIMIT 1;");
    }
    $GLOBALS['_user_id'] = false;
    setcookie('car', '', strtotime('+1 day'), '/', 'car.rcrowley.org');
}
コード例 #18
0
ファイル: TaskRepository.php プロジェクト: lavalite/task
 public function gadget($count)
 {
     return $this->model->with('user')->where(function ($query) {
         if (user('web')) {
             $query->whereUserId(user_id('web'));
         }
     })->orderBy('id', 'DESC')->take($count)->get();
 }
コード例 #19
0
 public function _format_data($mode)
 {
     $input = elements(['name', 'class', 'acquisition_method', 'acquisition_state', 'estimated_cost', 'beginning_quantity', 'details', 'is_disposed'], $this->input->post(), NULL);
     if ($mode === MODE_CREATE) {
         $input['created_by'] = user_id();
         unset($input['is_disposed']);
     }
     return $input;
 }
コード例 #20
0
 public function set_last_downloaded($questionnaire_id)
 {
     // Define the query
     $this->db->set('last_downloaded_date', 'NOW()', false);
     $this->db->set('last_downloaded_user', user_id());
     $this->db->where('questionnaire_id', $questionnaire_id);
     // Run the query
     $this->db->update('pdfs');
 }
コード例 #21
0
function login($username, $password)
{
    $db = new db();
    $userid = user_id($username);
    $username = mysqli_real_escape_string($db->getDb(), $username);
    $password = hash('sha512', $password);
    $query = $db->query("SELECT COUNT(user_id) from users WHERE username = '******' AND password = '******'");
    $row = $query->fetch_array();
    return $row[0] == 1 ? $userid : false;
}
コード例 #22
0
ファイル: File.php プロジェクト: Cevantime/site-core-modules
 public function isParentUniq($name, $parentId, $userId = null)
 {
     if (!$userId) {
         $userId = user_id();
     }
     if (!$parentId) {
         $parentId = null;
     }
     return $this->get(array('user_id' => $userId, 'name' => $name, 'parent_id' => $parentId)) == FALSE;
 }
コード例 #23
0
 function index()
 {
     //加载主页
     //reset_authed(I('param.id',"1"));//session设置
     $user_id['user_id'] = user_id();
     $data = M('resume')->where($user_id)->order("id desc")->select();
     //dump($data);
     $this->assign('data', $data);
     $this->display('resume:list');
 }
コード例 #24
0
 /**
  * Create new setting.
  *
  * @param Request $request
  *
  * @return Response
  */
 public function store(SettingAdminWebRequest $request)
 {
     try {
         $attributes = $request->all();
         $attributes['user_id'] = user_id('admin.web');
         $setting = $this->repository->create($attributes);
         return response()->json(['message' => trans('messages.success.updated', ['Module' => trans('settings::setting.name')]), 'code' => 204, 'redirect' => trans_url('/admin/settings/setting/' . $setting->getRouteKey())], 201);
     } catch (Exception $e) {
         return response()->json(['message' => $e->getMessage(), 'code' => 400], 400);
     }
 }
コード例 #25
0
ファイル: auth.php プロジェクト: rtconner/conner
/**
 * Return user data stored in session
 * TODO: cache/speed
 */
function user($key = null)
{
    if ($user_id = user_id()) {
        $user = m('user')->load($user_id);
        if ($key !== null) {
            return @$user[$key];
        }
        return $user;
    }
    return null;
}
コード例 #26
0
ファイル: Index.php プロジェクト: Cevantime/site-core-modules
 public function index($parent_id = null)
 {
     $this->load->helper('memberspace/connection');
     if (user_can('see', 'file', '*')) {
         $userId = user_id();
         $files = $this->{$this->modelName}->getGrouped(array('user_id' => $userId, 'parent_id' => $parent_id), $this->filters);
         $this->layout->view('filebrowser/index', array('files' => $files));
     } else {
         die(translate('vous ne pouvez pas accéder à cette ressource.'));
     }
 }
コード例 #27
0
 public function retrieveModuleLinks()
 {
     $response = $this->generateResponse();
     if (user_id()) {
         //Student Account Management
         $response["header"] = array();
         //Section Management
     } else {
         $response["error"][] = array("status" => 1, "error" => "Not Authorized");
     }
     echo json_encode($response);
 }
コード例 #28
0
ファイル: ResumeController.php プロジェクト: litecms/career
 /**
  * Show resume's list.
  *
  * @param string $slug
  *
  * @return response
  */
 protected function upload(Request $request)
 {
     try {
         $attributes = $request->all();
         $attributes['user_id'] = user_id();
         $resume = $this->repository->create($attributes);
         Session::flash('success', 'Success! Your Resume uploaded successfully.');
         return redirect(trans_url('careers/job'));
     } catch (Exception $e) {
         redirect()->back()->withInput()->with('message', $e->getMessage())->with('code', 400);
     }
 }
コード例 #29
0
 /**
  * Display the specified resource.
  *
  * @param Request $request
  *
  * @return Response
  */
 public function store(PortfolioUserRequest $request)
 {
     try {
         $attributes = $request->all();
         $attributes['user_id'] = user_id();
         $attributes['user_type'] = user_type();
         $portfolio = $this->repository->create($attributes);
         return redirect(trans_url('/user/portfolio/portfolio'))->with('message', trans('messages.success.created', ['Module' => trans('portfolio::portfolio.name')]))->with('code', 201);
     } catch (Exception $e) {
         redirect()->back()->withInput()->with('message', $e->getMessage())->with('code', 400);
     }
 }
コード例 #30
0
 /**
  * Create the specified resource.
  *
  * @param Request $request
  *
  * @return Response
  */
 public function store(AdminMenuWebRequest $request)
 {
     try {
         $attributes = $request->all();
         $attributes['user_id'] = user_id('admin.web');
         $attributes['parent_id'] = hashids_decode($attributes['parent_id']);
         $menu = $this->repository->create($attributes);
         return response()->json(['message' => trans('messages.success.updated', ['Module' => trans('menu::menu.name')]), 'code' => 204, 'redirect' => trans_url('/admin/menu/submenu/' . $menu->getRouteKey())], 201);
     } catch (Exception $e) {
         return response()->json(['message' => $e->getMessage(), 'code' => 400], 400);
     }
 }