本文整理汇总了PHP中Project::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::all方法的具体用法?PHP Project::all怎么用?PHP Project::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
** Function to plot graphs
***/
public function index()
{
if (isset($_POST) && !empty($_POST['datepickerfrom']) && !empty($_POST['datepickerto'])) {
$datefrom = $_POST['datepickerfrom'];
$dateto = $_POST['datepickerto'];
}
$projectsArray = Project::all();
/**Get all projects from databa se */
$result_array = Report::all();
if (!empty($result_array)) {
foreach ($result_array as $key => $res) {
$project[$key]['name'] = $res['name'];
$projects[$key]['id'] = $res['id'];
}
} else {
echo '<p class="error_msg">No data available in this range</p> <p>Please click <a href="?controller=pages&action=reportdata">Report</a> to select another range</p>';
exit;
}
$date_range = $this->getDatesFromRange($datefrom, $dateto);
$xaxis_data = json_encode($date_range);
for ($rs = 0; $rs < count($project); $rs++) {
foreach ($date_range as $dt) {
$bugs[$rs] = Report::find($projects[$rs]['id'], $dt);
$project[$rs]['data'][] = intval($bugs[$rs][$projects[$rs]['id']]['bugs']);
}
}
$result_array = json_encode($project);
require_once 'views/reports/index.php';
}
示例2: edit
public static function edit($id)
{
self::check_logged_in();
$task = Task::find($id);
$task->projectids = explode(",", $task->projectids);
$projects = Project::all();
View::make('task/edit.html', array('attributes' => $task, 'projects' => $projects));
}
示例3: getProjects
public function getProjects()
{
$projects = Project::all();
foreach ($projects as $project) {
$project->rendered_html = $project->html();
}
return $projects;
}
示例4: __construct
function __construct()
{
parent::__construct();
$this->view_data['core_settings'] = Setting::first();
if ($this->input->cookie('language') != "") {
$language = $this->input->cookie('language');
} else {
if (isset($this->view_data['language'])) {
$language = $this->view_data['language'];
} else {
if (!empty($this->view_data['core_settings']->language)) {
$language = $this->view_data['core_settings']->language;
} else {
$language = "english";
}
}
}
$this->lang->load('application', $language);
$this->lang->load('messages', $language);
$this->lang->load('event', $language);
$this->user = $this->session->userdata('user_id') ? User::find_by_id($this->session->userdata('user_id')) : FALSE;
$this->client = $this->session->userdata('client_id') ? Client::find_by_id($this->session->userdata('client_id')) : FALSE;
if ($this->client) {
$this->theme_view = 'application_client';
}
$this->view_data['datetime'] = date('Y-m-d H:i', time());
$this->view_data['sticky'] = Project::all(array('conditions' => 'sticky = 1'));
$this->view_data['quotations_new'] = Quote::find_by_sql("select count(id) as amount from quotations where status='New'");
if ($this->user || $this->client) {
$access = $this->user ? $this->user->access : $this->client->access;
$access = explode(",", $access);
if ($this->user) {
$this->view_data['menu'] = Module::find('all', array('order' => 'sort asc', 'conditions' => array('id in (?) AND type = ?', $access, 'main')));
$this->view_data['widgets'] = Module::find('all', array('conditions' => array('id in (?) AND type = ?', $access, 'widget')));
} else {
$this->view_data['menu'] = Module::find('all', array('order' => 'sort asc', 'conditions' => array('id in (?) AND type = ?', $access, 'client')));
}
if ($this->user) {
$update = User::find($this->user->id);
} else {
$update = Client::find($this->client->id);
}
$update->last_active = time();
$update->save();
if ($this->user) {
$this->view_data['user_online'] = User::all(array('conditions' => array('last_active+(30 * 60) > ? AND status = ?', time(), "active")));
$this->view_data['client_online'] = Client::all(array('conditions' => array('last_active+(30 * 60) > ? AND inactive = ?', time(), "0")));
}
$email = $this->user ? 'u' . $this->user->id : 'c' . $this->client->id;
$this->view_data['messages_new'] = Privatemessage::find_by_sql("select count(id) as amount from privatemessages where `status`='New' AND recipient = '" . $email . "'");
$this->view_data['tickets_new'] = Ticket::find_by_sql("select count(id) as amount from tickets where `status`='New'");
}
/*$this->load->database();
$sql = "select * FROM templates WHERE type='notes'";
$query = $this->db->query($sql); */
$this->view_data["note_templates"] = "";
//$query->result();
}
示例5: edit
public function edit()
{
if (!Auth::user()->is_superadmin) {
App::abort(403, 'Unauthorized action.');
}
$id = intval(Input::get('id'));
$user = null;
if ($id) {
$user = User::find($id);
}
$error = '';
if (Request::isMethod('post')) {
$username = trim(Input::get('username'));
$password = trim(Input::get('password'));
$is_superadmin = intval(Input::get('is_superadmin'));
$project_ids = Input::get('project', array());
if ($user) {
if ($password) {
$user->password = Hash::make($password);
}
} else {
if (!$username || !$password) {
$error = '信息不完整!';
}
if (User::where("username", $username)->count()) {
$error = '用户名不能和已有用户重复';
}
}
if (!$error) {
if (!$user) {
$user = new User();
$user->username = $username;
$user->password = Hash::make($password);
}
$user->is_superadmin = $is_superadmin;
$user->save();
//如果不是超级管理员,处理传过来的项目id数组
if (!$user->is_superadmin) {
$owned_pj = $user->pj_ids();
foreach ($project_ids as $value) {
if (!in_array($value, $owned_pj)) {
$_tmp = new UserProjectRelation();
$_tmp->uid = $user->id;
$_tmp->prj_id = $value;
$_tmp->save();
} else {
unset($owned_pj[array_search($value, $owned_pj)]);
}
}
if (!empty($owned_pj)) {
UserProjectRelation::where('uid', $user->id)->whereIn('prj_id', $owned_pj)->delete();
}
}
return Redirect::to('/users/index');
}
}
return View::make('users/edit', array('user' => $user, 'error' => $error, 'projects' => Project::all()));
}
示例6: index
public function index()
{
$currProject = Auth::user()->curr_project_id;
$currLocation = Auth::user()->location_id;
$projects = Project::all();
$locations = Location::all();
$menu = 'setup';
return View::make('setups/index', compact('projects', 'locations', 'currProject', 'currLocation', 'menu'));
}
示例7: index
public function index()
{
$projects = Project::all();
if (count($projects)) {
foreach ($projects as $project) {
$project->image = $project->images()->first();
}
return Response::json($projects);
} else {
return Response::json(['alert' => 'Projects' . Messages::$notFound], 404);
}
}
示例8: getDashboard
/**
* Handles GET requests for /dashboard
*
* @return view
*/
public function getDashboard()
{
if ($this->user->hasAnyAccess(['manage'])) {
$projects = Project::all();
} else {
if (!empty($projects = $this->setProjects())) {
$projects = Project::whereIn('id', $projects)->orWhere('user_id', $this->user->id)->orderBy('id')->get();
} else {
$projects = Project::where('user_id', $this->user->id)->orderBy('id')->get();
}
}
return View::make('layouts.dashboard')->with(['projects' => $projects]);
}
示例9: filter
function filter($condition)
{
switch ($condition) {
case 'open':
$options = array('conditions' => 'progress < 100');
break;
case 'closed':
$options = array('conditions' => 'progress = 100');
break;
}
$this->view_data['project'] = Project::all($options);
$this->content_view = 'projects/all';
}
示例10: showProject
public function showProject($id)
{
$project = Project::find($id);
if ($id == 'random') {
$projects = Project::all();
$project = $projects[mt_rand(0, count($projects) - 1)];
}
if (!$project) {
return Redirect::to('search')->with('error', 'Oops! It seems we can\'t find the page you are looking for. Try search instead.');
}
$geojson = 'pin-l-circle-stroked+1abc9c(' . $project->geo()->lng . ',' . $project->geo()->lat . ')/' . $project->geo()->lng . ',' . $project->geo()->lat . '),13';
$map_image_link = 'https://api.tiles.mapbox.com/v4/codeforafrica.ji193j10/' . $geojson . '/520x293.png256?' . 'access_token=pk.eyJ1IjoiY29kZWZvcmFmcmljYSIsImEiOiJVLXZVVUtnIn0.JjVvqHKBGQTNpuDMJtZ8Qg';
$data = compact('project', 'map_image_link', 'geojson');
return view('home.project', $data);
}
示例11: filter
function filter($condition)
{
switch ($condition) {
case 'open':
$options = array('conditions' => 'progress < 100');
break;
case 'closed':
$options = array('conditions' => 'progress = 100');
break;
}
$this->view_data['project'] = Project::all($options);
$this->content_view = 'projects/all';
$this->view_data['projects_assigned_to_me'] = ProjectHasWorker::find_by_sql('select count(distinct(projects.id)) AS "amount" FROM projects, project_has_workers WHERE projects.progress != "100" AND (projects.id = project_has_workers.project_id AND project_has_workers.user_id = "' . $this->user->id . '") ');
$this->view_data['tasks_assigned_to_me'] = ProjectHasTask::count(array('conditions' => 'user_id = ' . $this->user->id . ' and status = "open"'));
$now = time();
$beginning_of_week = strtotime('last Monday', $now);
// BEGINNING of the week
$end_of_week = strtotime('next Sunday', $now) + 86400;
// END of the last day of the week
$this->view_data['projects_opened_this_week'] = Project::find_by_sql('select count(id) AS "amount", DATE_FORMAT(FROM_UNIXTIME(`datetime`), "%w") AS "date_day", DATE_FORMAT(FROM_UNIXTIME(`datetime`), "%Y-%m-%d") AS "date_formatted" from projects where datetime >= "' . $beginning_of_week . '" AND datetime <= "' . $end_of_week . '" ');
}
示例12: savestatus
public function savestatus()
{
$projects = Project::all();
$pr_id = $_POST['project_list'];
$dateofbug = $_POST['datepicker'];
$bugs = $_POST['bugs'];
$exst = Project::checkBugsbypro($pr_id, $dateofbug);
if ($exst) {
$update = Project::updateBugsbypro($bugs, $pr_id, $dateofbug);
if ($update) {
$this->redirecturl('pages', 'createstatus', 'true');
} else {
$this->redirecturl('pages', 'createstatus', 'false');
}
} else {
$bugsave = Project::insertBugs($pr_id, $dateofbug, $bugs);
if ($bugsave) {
$this->redirecturl('pages', 'createstatus', 'true');
}
}
}
示例13: index
/**
* Display a listing of the resource.
* GET /projects
*
* @return Response
*/
public function index()
{
$projects = Project::all();
//return View::make('projects.index');
$this->layout->content = View::make('projects.index', compact('projects'));
}
示例14: update
function update($id = FALSE, $getview = FALSE)
{
if ($_POST) {
unset($_POST['send']);
unset($_POST['_wysihtml5_mode']);
unset($_POST['files']);
$config['upload_path'] = './files/media/';
$config['encrypt_name'] = TRUE;
$config['allowed_types'] = '*';
$this->load->library('upload', $config);
if ($this->upload->do_upload()) {
$data = array('upload_data' => $this->upload->data());
if ($_POST['attachment_description'] == "") {
$_POST['attachment_description'] = $data['upload_data']['orig_name'];
}
$_POST['attachment'] = $data['upload_data']['file_name'];
}
$id = $_POST['id'];
$expense = Expense::find_by_id($id);
$expense->update_attributes($_POST);
if (!$expense) {
$this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_save_expense_error'));
} else {
$this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_save_expense_success'));
}
redirect('expenses');
} else {
$this->view_data['next_reference'] = Expense::last();
$this->view_data['expense'] = Expense::find_by_id($id);
$this->view_data['projects'] = Project::all();
$this->view_data['core_settings'] = Setting::first();
$this->view_data['companies'] = Company::find('all', array('conditions' => array('inactive=?', '0')));
$this->theme_view = 'modal';
$this->view_data['categories'] = Expense::find_by_sql("select category from expenses group by category");
$this->view_data['title'] = $this->lang->line('application_create_expense');
$this->view_data['form_action'] = 'expenses/update';
$this->content_view = 'expenses/_expense';
}
}
示例15: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$projects = Project::all();
return View::make('projects.index')->withProjects($projects);
}