本文整理汇总了PHP中updateLastActive函数的典型用法代码示例。如果您正苦于以下问题:PHP updateLastActive函数的具体用法?PHP updateLastActive怎么用?PHP updateLastActive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了updateLastActive函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
requirelogin();
updateLastActive();
$this->load->model('mdb');
}
示例2: task
public function task($pid = 0)
{
requirelogin();
updateLastActive();
$keyword = $this->input->get('q');
$tid = (int) $this->input->get('folder');
$page = (int) $this->input->get('page');
$page = $page > 1 ? $page : 1;
$pageOrig = $page > 1 ? $page - 1 : 0;
$itemsPerPage = 10;
$sqStart = $pageOrig * $itemsPerPage;
if ($tid > 0) {
$query = $this->fdb->get_task_files($pid, $tid, 0, $keyword, $sqStart, $itemsPerPage);
$items = $this->processItems($query);
$qAllItems = $this->fdb->get_task_files($pid, $tid, 0, $keyword, 0, 0);
$allItems = (int) $qAllItems->num_rows();
$total_page = $allItems > 0 ? ceil($allItems / $itemsPerPage) : 1;
generate_json(array('status' => 1, 'items' => $items, 'total_page' => number_format($total_page), 'current_page' => $page, 'previous_page' => $page > 1 ? $page - 1 : '', 'next_page' => $page < $total_page ? $page + 1 : '', 'total_items' => number_format($allItems)));
} else {
$query = $this->fdb->get_tasks($pid, $keyword, $sqStart, $itemsPerPage);
$items = array();
foreach ($query->result() as $row) {
$items[] = array('id' => $row->id, 'attachment_type' => 'folder', 'uploader_id' => 0, 'uploader_name' => '', 'filename' => $row->title, 'filesize' => '', 'uploaded' => '', 'icon' => 'folder');
}
$qAllItems = $this->fdb->get_tasks($pid, $keyword, 0, 0);
$allItems = (int) $qAllItems->num_rows();
$total_page = $allItems > 0 ? ceil($allItems / $itemsPerPage) : 1;
generate_json(array('status' => 1, 'items' => $items, 'total_page' => number_format($total_page), 'current_page' => $page, 'previous_page' => $page > 1 ? $page - 1 : '', 'next_page' => $page < $total_page ? $page + 1 : '', 'total_items' => number_format($allItems)));
}
}
示例3: do_update
public function do_update()
{
requirelogin();
updateLastActive();
$myID = getUserID();
$pid = (int) jsonInput('id');
$myRole = (int) get_project_roles($pid, $myID);
$query = $this->mdb->project_get($pid);
if ($query->num_rows()) {
$row = $query->row();
if ($myRole > 0 || $myID == $row->creator_id) {
$title = trim(jsonInput('title'));
$description = jsonInput('description');
$status = (int) jsonInput('status');
$privacy = (int) jsonInput('privacy');
$task_approval = jsonInput('task_approval') ? 1 : 0;
$project_approval = jsonInput('project_approval') ? 1 : 0;
if (empty($title)) {
generate_json(array('status' => 0, 'message' => 'Project title is required.'));
} elseif ($status < 0 || $status > 1) {
generate_json(array('status' => 0, 'message' => 'Invalid status.'));
} elseif ($privacy < 0 || $privacy > 2) {
generate_json(array('status' => 0, 'message' => 'Invalid privacy settings.'));
} else {
$sql = $this->mdb->project_update($pid, array('project_name' => $title, 'description' => $description, 'completed' => $status, 'privacy' => $privacy));
$this->mdb->projSettings_update(array('project_id' => $pid), array('task_approval' => $task_approval, 'project_approval' => $project_approval));
generate_json(array('status' => 1));
}
} else {
generate_json(array('status' => 0, 'message' => 'You are not allowed here.'));
}
} else {
generate_json(array('status' => 0, 'message' => 'Project not found.'));
}
}
示例4: __construct
public function __construct()
{
parent::__construct();
requirelogin('400');
$this->load->helper('project');
$this->load->model('mdb');
updateLastActive();
}
示例5: __construct
public function __construct()
{
parent::__construct();
$this->load->model('mdb');
requirelogin();
$this->load->config('config');
$this->load->helper('google');
updateLastActive();
}
示例6: index
public function index()
{
updateLastActive();
$myID = getUserID();
$filepath = 'uploads/files/' . $myID . '/';
$pid = (int) $this->input->get('pid');
$tid = (int) $this->input->get('tid');
if (!file_exists($filepath)) {
mkdir($filepath, 0777, true);
}
if (!validate_access('valid_member', array('project_id' => $pid, 'user_id' => $myID))) {
$this->output->set_status_header('400');
echo 'You dont have enough permission to do this.';
} else {
$config['upload_path'] = $filepath;
$config['allowed_types'] = 'jpg|gif|jpeg|bmp|ico|png|zip|rar|gz|mp3|mp4|mkv|avi|txt|apk|ipa|tar|exe|doc|docx|xls|xlsx|ppt|pptx|pdf';
$config['max_size'] = 30000;
$config['encrypt_name'] = true;
$config['max_filename'] = 200;
$config['remove_spaces'] = false;
$this->load->library('upload', $config);
if ($this->upload->do_upload('file')) {
$data = $this->upload->data();
$newID = $this->mdb->add_attachment(array('attachment_type' => 'file', 'uploader' => $myID, 'project_id' => $pid, 'task_id' => $tid, 'post_id' => 0, 'filename' => $data['orig_name'], 'filepath' => $data['file_name'], 'filesize' => $data['file_size'] * 1024, 'extension' => $data['file_ext'], 'date_added' => today(), 'date_deleted' => null, 'deleted_by' => 0, 'parent_folder' => 0));
$imgTypes = array('.gif', '.jpg', '.jpeg', '.png');
if (in_array(strtolower($data['file_ext']), $imgTypes)) {
$this->load->library('image_lib');
$thumbpath = $filepath . 'thumbs/';
if (!file_exists($thumbpath)) {
mkdir($thumbpath, 0777, true);
}
$config = array('image_library' => 'gd2', 'source_image' => $filepath . $data['file_name'], 'new_image' => $thumbpath . $data['file_name'], 'maintain_ratio' => true, 'height' => 300, 'width' => 300);
$this->image_lib->initialize($config);
$this->image_lib->resize();
$this->image_lib->clear();
}
echo $newID;
} else {
$errors = $this->upload->display_errors('', '|');
$errorsArr = explode("|", $errors);
$this->output->set_status_header('401');
echo isset($errorsArr[0]) ? $errorsArr[0] : '';
}
}
}
示例7: generate
public function generate($pid = 0)
{
requirelogin();
updateLastActive();
$type = jsonInput('type');
$member = (int) jsonInput('member');
$dateFrom = jsonInput('date_from');
$dateTo = jsonInput('date_to');
$myID = getUserID();
if (!validate_access('valid_member', array('project_id' => $pid, 'user_id' => $myID))) {
generate_json(array('status' => 0, 'message' => 'You dont have enough permission to do this.'));
} else {
switch ($type) {
case 'project':
$this->session->set_userdata('project_report', array('project_id' => $pid, 'type' => $type));
generate_json(array('status' => 1));
break;
case 'member':
$this->session->set_userdata('project_report', array('project_id' => $pid, 'type' => $type, 'date_from' => $dateFrom, 'date_to' => $dateTo));
generate_json(array('status' => 1));
break;
case 'task':
$statuses = array('active', 'completed', 'pending', 'active_complete');
$taskStat = trim(jsonInput('task_status'));
$taskStat = in_array($taskStat, $statuses) ? $taskStat : "";
$this->session->set_userdata('project_report', array('project_id' => $pid, 'type' => $type, 'status' => $taskStat, 'date_from' => $dateFrom, 'date_to' => $dateTo));
generate_json(array('status' => 1));
break;
case 'personel':
if ($member > 0) {
if (validate_access('valid_member', array('project_id' => $pid, 'user_id' => $member))) {
$this->session->set_userdata('project_report', array('member' => $member, 'project_id' => $pid, 'type' => $type));
generate_json(array('status' => 1));
} else {
generate_json(array('status' => 0, 'message' => 'This user is not a member of this project.'));
}
} else {
generate_json(array('status' => 0, 'message' => 'Please select a member.'));
}
break;
default:
generate_json(array('status' => 0, 'message' => 'Unknown report type.'));
}
}
}
示例8: data
public function data($pid = 0)
{
requirelogin();
updateLastActive();
$page = (int) $this->input->get('page');
$page = $page > 1 ? $page : 1;
$pageOrig = $page > 1 ? $page - 1 : 0;
$itemsPerPage = 10;
$sqStart = $pageOrig * $itemsPerPage;
$sql = $this->ldb->get_data($pid, $sqStart, $itemsPerPage);
$items = array();
foreach ($sql->result() as $row) {
$timestamp = convert_datetime($row->date_added);
$items[] = array('activity' => projectlogs_read($row->type, $row->tag_data), 'actor_id' => $row->actor_id, 'actor_name' => $row->display_name, 'timestamp' => relativedate(strtotime($timestamp)), 'redirect' => $row->redirect);
}
$qAllItems = $this->ldb->get_data($pid, 0, 0);
$allItems = (int) $qAllItems->num_rows();
$total_page = $allItems > 0 ? ceil($allItems / $itemsPerPage) : 1;
generate_json(array('status' => 1, 'items' => $items, 'total_page' => number_format($total_page), 'current_page' => $page, 'previous_page' => $page > 1 ? $page - 1 : '', 'next_page' => $page < $total_page ? $page + 1 : '', 'total_items' => number_format($allItems)));
}
示例9: lists
public function lists($page = 1)
{
requirelogin();
updateLastActive();
$myID = getUserID();
$page = (int) $page;
$page = $page > 1 ? $page : 1;
$pageOrig = $page > 1 ? $page - 1 : 0;
$itemsPerPage = 6;
$sqStart = $pageOrig * $itemsPerPage;
$query = $this->mdb->projects_get($myID, $sqStart, $itemsPerPage);
$items = array();
foreach ($query->result() as $row) {
$allTasks = (int) $row->active_tasks + (int) $row->completed_tasks;
$tActive_percent = (int) $row->active_tasks > 0 ? $row->active_tasks / $allTasks * 100 : 0;
$tCompleted_percent = (int) $row->completed_tasks > 0 ? $row->completed_tasks / $allTasks * 100 : 0;
$tPending_percent = (int) $row->pending_tasks > 0 ? $row->pending_tasks / ($allTasks + $row->pending_tasks) * 100 : 0;
$items[] = array('id' => $row->id, 'name' => $row->project_name, 'active_tasks' => array('count' => $row->active_tasks, 'percentage' => $tActive_percent), 'completed_tasks' => array('count' => $row->completed_tasks, 'percentage' => $tCompleted_percent), 'pending_tasks' => array('count' => $row->pending_tasks, 'percentage' => $tPending_percent), 'creator' => $row->display_name, 'description' => empty($row->description) ? '[No description]' : $row->description, 'last_update' => relativedate(strtotime($row->last_update), false), 'created_month' => date("M", strtotime($row->date_created)), 'created_year' => date("Y", strtotime($row->date_created)), 'avatar' => 'pictures/avatar/' . $row->creator_id . '/thumb');
}
$qAllItems = $this->mdb->projects_get($myID, 0, 0);
$allItems = (int) $qAllItems->num_rows();
$total_page = $allItems > 0 ? ceil($allItems / $itemsPerPage) : 1;
generate_json(array('status' => 1, 'items' => $items, 'total_page' => number_format($total_page), 'current_page' => $page, 'previous_page' => $page > 1 ? $page - 1 : '', 'next_page' => $page < $total_page ? $page + 1 : '', 'total_items' => number_format($allItems)));
}
示例10: get_data
public function get_data($id = 0)
{
requirelogin();
updateLastActive();
$id = (int) $id;
$cp = (int) $this->input->get('p');
$type = strtolower($this->input->get('type'));
$itemsPerPage = 5;
$myID = getUserID();
if (!validate_access('valid_member', array('project_id' => $id, 'user_id' => $myID))) {
generate_json(array('status' => 0, 'message' => 'You dont have enough permission to do this.'));
} else {
$priorities = $this->config->item('priorities');
$priorityColors = array('bg-light', 'bg-warning dker', 'bg-danger');
$page = $cp > 1 ? $cp : 1;
$pageOrig = $page > 1 ? $page - 1 : 0;
$sqStart = $pageOrig * $itemsPerPage;
$qPendingItems = $this->mdb->tasks_get_pending($id, 0, 0);
switch ($type) {
case 'upcoming':
$query = $this->mdb->tasks_get_upcoming($id, $sqStart, $itemsPerPage);
$qAllItems = $this->mdb->tasks_get_upcoming($id, 0, 0);
break;
case 'completed':
$query = $this->mdb->tasks_get_completed($id, $sqStart, $itemsPerPage);
$qAllItems = $this->mdb->tasks_get_completed($id, 0, 0);
break;
case 'pending':
$query = $this->mdb->tasks_get_pending($id, $sqStart, $itemsPerPage);
$qAllItems = $qPendingItems;
break;
default:
$query = $this->mdb->tasks_get_current($id, $sqStart, $itemsPerPage);
$qAllItems = $this->mdb->tasks_get_current($id, 0, 0);
}
$items = array();
foreach ($query->result() as $row) {
$qMembers = $this->mdb->task_members_get($row->id, 3);
$members = array();
foreach ($qMembers->result() as $member) {
$members[] = array('id' => $member->user_id, 'display_name' => $member->display_name);
}
$items[] = array('id' => $row->id, 'title' => $row->title, 'description' => empty($row->description) ? "<no description>" : $row->description, 'priority_id' => $row->priority, 'priority' => isset($priorities[$row->priority]) ? $priorities[$row->priority] : '', 'priority_class' => isset($priorityColors[$row->priority]) ? $priorityColors[$row->priority] : $priorityColors[0], 'creator_id' => $row->creator_id, 'creator_name' => $row->creator_name, 'date_created' => date("m/d/Y", strtotime($row->date_created)), 'date_start' => $row->date_start ? date("m/d/Y", strtotime($row->date_start)) : 'TBA', 'date_end' => $row->date_end ? date("m/d/Y", strtotime($row->date_end)) : 'TBA', 'date_completed' => $row->date_completed ? date("m/d/Y", strtotime($row->date_completed)) : 'n/a', 'remarks' => empty($row->remarks) ? "No remarks." : $row->remarks, 'random_members' => $members);
}
$allItems = $qAllItems->num_rows();
$pendingTasks = $qPendingItems->num_rows();
$total_page = $allItems > 0 ? ceil($allItems / $itemsPerPage) : 1;
generate_json(array('status' => 1, 'items' => $items, 'total_page' => number_format($total_page), 'current_page' => $page, 'previous_page' => $page > 1 ? $page - 1 : '', 'next_page' => $page < $total_page ? $page + 1 : '', 'total_items' => number_format($allItems), 'pending' => $pendingTasks > 0 ? $pendingTasks : '', 'type' => ucfirst($type)));
}
}
示例11: check_session
public function check_session()
{
$uid = getUserID();
updateLastActive();
generate_json(array('status' => $uid ? 1 : 0));
}
示例12: add_member
public function add_member()
{
requirelogin();
updateLastActive();
$id = (int) jsonInput('id');
$members = jsonInput('members');
$myID = getUserID();
$query = $this->mdb->task_get($id);
if ($query->num_rows()) {
$row = $query->row();
$isModerator = validate_access('is_moderator', array('project_id' => $row->project_id, 'user_id' => $myID));
$qMember = $this->mdb->taskMembers_get(array('task_id' => $row->id, 'user_id' => $myID, 'is_accepted' => 1));
if ($isModerator || $qMember->num_rows() || $myID == $row->creator_id) {
if (is_array($members) && count($members)) {
foreach ($members as $member) {
$qChkUser = $this->model->getUserInfo(array('email_address' => $member));
if ($qChkUser->num_rows()) {
$memberRow = $qChkUser->row();
$qChkIfMember = $this->mdb->taskMembers_get(array('task_id' => $row->id, 'user_id' => $memberRow->id));
if ($qChkIfMember->num_rows()) {
generate_json(array('status' => 0, 'message' => $member . ' is already assigned to this task.'));
exit;
} else {
if (!validate_access('valid_member', array('project_id' => $row->project_id, 'user_id' => $memberRow->id))) {
generate_json(array('status' => 0, 'message' => $member . ' is not a member of this project.'));
exit;
}
}
} else {
generate_json(array('status' => 0, 'message' => $member . ' does not exists.'));
exit;
}
}
foreach ($members as $member) {
$qChkUser = $this->model->getUserInfo(array('email_address' => $member));
if ($qChkUser->num_rows()) {
$memberRow = $qChkUser->row();
$this->mdb->taskMembers_add(array('task_id' => $row->id, 'user_id' => $memberRow->id, 'assigned_by' => $myID, 'is_accepted' => $memberRow->id == $myID ? 1 : 0, 'date_joined' => today()));
//notification
notify('task_invite', $memberRow->id, array('project_id' => $row->project_id, 'task_id' => $row->id));
$qProj = $this->db->get_where('projects', array('id' => $row->project_id));
if ($qProj->num_rows()) {
$qProjRow = $qProj->row();
$myName = $this->session->userdata('display_name');
$redirectLink = base_url('#/app/projects/' . $row->project_id . '/task/' . $row->id);
do_sendmail($memberRow->id, $qProjRow->project_name, "{$myName} assigned a task for you in <a href='{$redirectLink}'>" . $qProjRow->project_name . "</a>");
}
}
}
generate_json(array('status' => 1, 'message' => 'Member(s) was invited to this task.'));
} else {
generate_json(array('status' => 0, 'message' => 'No people(s) to add.'));
}
} else {
generate_json(array('status' => 0, 'message' => 'You are not allowed to do this.'));
}
} else {
generate_json(array('status' => 0, 'message' => 'Task does not exists.'));
}
}
示例13: projList
public function projList()
{
requirelogin();
updateLastActive();
$myID = getUserID();
$query = $this->mdb->projects_get($myID, 0, 0);
$items = array();
foreach ($query->result() as $row) {
$items[] = array('id' => $row->id, 'name' => $row->project_name);
}
generate_json(array('status' => 1, 'items' => $items));
}
示例14: update
public function update($id = 0)
{
requirelogin();
updateLastActive();
$myID = getUserID();
$query = $this->mdb->feed_details($id);
$content = trim(jsonInput('post'));
if ($query->num_rows()) {
$row = $query->row();
if ($row->poster_id == $myID) {
if (!empty($content)) {
$this->mdb->feed_update(array('id' => $row->id), array('post_message' => $content));
generate_json(array('status' => 1));
} else {
generate_json(array('status' => 0, 'message' => 'Please type a post.'));
}
} else {
generate_json(array('status' => 0, 'message' => 'You cannot edit this post! maybe its not yours'));
}
} else {
generate_json(array('status' => 0, 'message' => 'Post not found.'));
}
}