本文整理汇总了PHP中Issue::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Issue::find方法的具体用法?PHP Issue::find怎么用?PHP Issue::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Issue
的用法示例。
在下文中一共展示了Issue::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$student = Student::find($id);
if ($student == NULL) {
throw new Exception('Invalid Student ID');
}
$student->year = (int) substr($student->year, 2, 4);
$student_category = StudentCategories::find($student->category);
$student->category = $student_category->category;
$student_branch = Branch::find($student->branch);
$student->branch = $student_branch->branch;
if ($student->rejected == 1) {
unset($student->approved);
unset($student->books_issued);
$student->rejected = (bool) $student->rejected;
return $student;
}
if ($student->approved == 0) {
unset($student->rejected);
unset($student->books_issued);
$student->approved = (bool) $student->approved;
return $student;
}
unset($student->rejected);
unset($student->approved);
$student_issued_books = Logs::select('book_issue_id', 'issued_at')->where('student_id', '=', $id)->orderBy('time_stamp', 'desc')->take($student->books_issued)->get();
foreach ($student_issued_books as $issued_book) {
$issue = Issue::find($issued_book->book_issue_id);
$book = Books::find($issue->book_id);
$issued_book->name = $book->title;
$issued_book->issued_at = date('d-M', $issued_book->issued_at);
}
$student->issued_books = $student_issued_books;
return $student;
}
示例2: destroy
function destroy()
{
# @issue_count = @category.issues.size
# if @issue_count == 0
# # No issue assigned to this category
# @category.destroy
# redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'categories'
# elsif params[:todo]
# reassign_to = @project.issue_categories.find_by_id(params[:reassign_to_id]) if params[:todo] == 'reassign'
# @category.destroy(reassign_to)
# redirect_to :controller => 'projects', :action => 'settings', :id => @project, :tab => 'categories'
# end
App::import('model', 'Issue');
$Issue = new Issue();
$issue_count = $Issue->find('count', aa('conditions', aa('category_id', $this->params['id'])));
if ($issue_count == 0) {
$this->IssueCategory->del($this->params['id']);
$this->redirect(aa('controller', 'projects', 'action', 'settings', 'project_id', $this->_project['Project']['identifier'], '?', 'tab=categories'));
} elseif ($this->data) {
$reassgin_to = null;
if ($this->data['IssueCategory']['todo'] == 'reassgin_to') {
$reassgin_to = $this->data['IssueCategory']['reassign_to_id'];
}
$this->IssueCategory->del_with_reassgin($this->params['id'], $reassgin_to);
$this->redirect(aa('controller', 'projects', 'action', 'settings', 'project_id', $this->_project['Project']['identifier'], '?', 'tab=categories'));
}
$issue_category_data = $this->IssueCategory->find('first', aa('conditions', aa('IssueCategory.id', $this->params['id'])));
$this->set('issue_category_data', $issue_category_data);
$this->set('issue_count', $issue_count);
}
示例3: show
public function show($id)
{
$issue = Issue::find($id);
$retrievals = Retrieval::where('issue_id', '=', $id)->get();
$handbooks = Handbook::where('project_id', '=', Auth::user()->curr_project_id)->where('generation_id', '=', $issue->generation_id)->get();
$menu = 'student';
return View::make('retrievals.show', compact('issue', 'retrievals', 'handbooks', 'menu'));
}
示例4: loadEarnables
public function loadEarnables($issue_id)
{
$issue = Issue::find($issue_id);
$receivable = Receivable::with('installments_not_paid')->where('issue_id', '=', $issue_id)->first();
$registrations = Registration::where('student_id', '=', $issue->student_id)->where('cost_is_paid', '=', 0)->get();
$movements = Movement::where('issue_id', '=', $issue_id)->get();
$punishments = Punishment::where('issue_id', '=', $issue_id)->where('paid', '=', 0)->get();
$resigns = Resign::where('issue_id', '=', $issue_id)->where('is_earned', '=', 0)->get();
$responses = array('receivable' => $receivable, 'registrations' => $registrations, 'movements' => $movements, 'punishments' => $punishments, 'resigns' => $resigns);
return $responses;
}
示例5: create
public function create($issue_id)
{
$issue = Issue::find($issue_id);
$receivable = Receivable::with('installments')->where('issue_id', '=', $issue_id)->first();
$registration = Registration::where('student_id', '=', $issue->student_id)->where('cost_is_paid', '=', 0)->first();
$movements = Movement::where('issue_id', '=', $issue_id)->where('paid', '=', 0)->get();
$punishments = Punishment::where('issue_id', '=', $issue_id)->where('paid', '=', 0)->get();
$resigns = Resign::where('issue_id', '=', $issue_id)->where('fines', '>', 0.0)->where('is_earned', '=', 0)->get();
$employees = Employee::where('location_id', '=', Auth::user()->location_id)->get();
$menu = 'finance';
return View::make('earnings.create', compact('issue', 'receivable', 'registration', 'movements', 'punishments', 'resigns', 'employees', 'menu'));
}
示例6: updateIssue
public function updateIssue()
{
$issue_name = Input::get('issue_name');
$issue_id = Input::get('issue_id');
$already_created = Issue::where('issue_name', '=', $issue_name);
if (!($already_created->count() > 0)) {
if (isset($issue_name)) {
$issue = Issue::find($issue_id);
$issue->issue_name = $issue_name;
$issue->save();
return null;
// Response::json(array('issue_name'=>'A WEALTH','issue_id'=>$issue_id));
}
} else {
//return Response::json(array('issue_name'=>'B WEALTH','issue_id'=>$issue_id));
return Response::json(array('issue_name' => $already_created->first()->issue_name));
}
//return Response::json($return);
}
示例7: destroy
public function destroy()
{
App::uses('Issue', 'Model');
$Issue = new Issue();
$issue_count = $Issue->find('count', array('conditions' => array('category_id' => $this->request->params['id'])));
if ($issue_count == 0) {
$this->IssueCategory->delete($this->request->params['id']);
$this->redirect(array('controller' => 'projects', 'action' => 'settings', '?' => 'tab=categories', 'project_id' => $this->_project['Project']['identifier']));
} elseif ($this->request->data) {
$reassgin_to = null;
if ($this->request->data['IssueCategory']['todo'] == 'reassgin_to') {
$reassgin_to = $this->request->data['IssueCategory']['reassign_to_id'];
}
$this->IssueCategory->del_with_reassgin($this->request->params['id'], $reassgin_to);
$this->redirect(array('controller' => 'projects', 'action' => 'settings', '?' => 'tab=categories', 'project_id' => $this->_project['Project']['identifier']));
}
$issue_category_data = $this->IssueCategory->find('first', array('conditions' => array('IssueCategory.id' => $this->request->params['id'])));
$this->set('issue_category_data', $issue_category_data);
$this->set('issue_count', $issue_count);
}
示例8: store
public function store()
{
$fine = Input::get('fine');
$returnment = Input::get('returnment');
$returnment = str_replace(",", ".", $returnment);
$returnment = str_replace(".", "", $returnment);
$returnment = substr($returnment, 0, -2);
$fine = str_replace(",", ".", $fine);
$fine = str_replace(".", "", $fine);
$fine = substr($fine, 0, -2);
try {
$resign = new Resign();
$resign->project_id = Auth::user()->curr_project_id;
$resign->location_id = Auth::user()->location_id;
$resign->issue_id = Input::get('issue_id');
$resign->employee_id = Input::get('employee_id');
$resign->classification_id = Input::get('classification_id');
$resign->resign_date = Input::get('date');
$resign->fines = $fine;
$resign->returnment = $returnment;
$resign->comments = Input::get('comments');
$resign->save();
$issue = Issue::with('placements')->find(Input::get('issue_id'));
foreach ($issue->placements as $placement) {
$placement->resign_id = $resign->id;
$placement->active = 0;
$placement->save();
}
$issue = Issue::find(Input::get('issue_id'));
$issue->is_active = 0;
$issue->save();
return Response::json(array('status' => 'succeed'));
} catch (Exception $e) {
return Response::json(array('status' => 'failed', 'pesan' => $e));
}
}
示例9: getIssuesCountUsingHunterUidAndProductAndCategoryAndStatus
/**
* Get number of issues in a certain product, category, status and founded by a certain user.
* @param long $hunterUid - the unique ID of the user who founded the issue
* @param long $productId - the unique ID of the product
* @param int $issueCategoryId - the unique ID of a category of issue
* @param int $issueStatusId - the unique ID of a status of issue
* @return number of issues in a certain product, category, status and founded by a certain user
*/
public function getIssuesCountUsingHunterUidAndProductAndCategoryAndStatus($hunterUid, $productId, $issueCategoryId, $issueStatusId)
{
$conditions = $this->getQueryOfIssuesUsingHunterUidAndProductAndCategoryAndStatus($hunterUid, $productId, $issueCategoryId, $issueStatusId);
$resultSet = Issue::find($conditions);
return $resultSet->count();
}
示例10: dBug
require_once '../../../config.inc.php';
require_once 'common.php';
require_once '../../../third_party/lux-phpactiveresource/ActiveResource.php';
class Issue extends ActiveResource
{
// var $site = 'http://testlink.redmine:redmine2012@testlink.m.redmine.org/';
var $site = 'http://testlink.m.redmine.org/';
var $request_format = 'xml';
// REQUIRED!
var $user = 'testlink.redmine';
var $password = 'redmine2012';
}
// find issues
$issue = new Issue();
new dBug($issue);
$x = $issue->find('all');
var_dump($x);
//$issues = $issueMgr->find(d);
//echo '<pre>' . var_dump($issues) . '</pre>';
//$issuesQty = count($issues);
//for ($idx=0; $idx < $issuesQty; $idx++)
//{
// echo $issues[$idx]->subject;
//}
//// find and update an issue
//$issue->find (1);
//echo $issue->subject;
//$issue->set ('subject', 'This is the new subject')->save ();
//// delete an issue
//$issue->find (1);
//$issue->destroy ();
示例11: reassignIssues
/**
* Reassign assigned issues
* @param int $user_id
* @return int Number of issues affected
* @throws \Exception
*/
public function reassignIssues($user_id)
{
if (!$this->id) {
throw new \Exception("User is not initialized.");
}
$issue_model = new Issue();
$issues = $issue_model->find(array("owner_id = ? AND deleted_date IS NULL AND closed_date IS NULL", $this->id));
foreach ($issues as $issue) {
$issue->owner_id = $user_id;
$issue->save();
}
return count($issues);
}
示例12: home
public function home()
{
//Tag Cloud
$con = mysqli_connect("127.0.0.1", "root", "pepper", "iratepolitics");
//create list of issues that have received votes by selecting
//rows on first occurance of each unique value
$query = "select id,issue_id from ratings group by issue_id;";
$result = mysqli_query($con, $query);
$issue_tag_cloud = "";
$i = 0;
//for each id in list of issues, count all the rows in ratings
while ($row = mysqli_fetch_array($result)) {
$query = "select id from ratings where issue_id=" . $row['issue_id'];
//echo 'query: '.$query;
$result2 = mysqli_query($con, $query);
$issue_name = Issue::find($row['issue_id'])->issue_name;
if ($issue_name != null) {
$issue_tag_cloud .= '{text: "' . ucwords($issue_name) . '", weight: ' . mysqli_num_rows($result2) . ' , link: "' . URL::route('news', $issue_name) . '"},' . "\n";
}
}
//close while
//remove trailing new line and trailing comma so tag cloud js will work
$issue_tag_cloud = substr_replace($issue_tag_cloud, "", -1);
$issue_tag_cloud = substr_replace($issue_tag_cloud, "", -1);
//Comment Feed: Take top 3 highest ranked comments
$comments = DB::table('comments')->where('politician_id', '>', 0)->orderBy('rank', 'desc')->orderBy('created_at', 'desc')->take(3)->get();
//News Feed: Take last 3 news for now
$news = DB::table('news')->take(3)->get();
$comments_array = array();
$news_array = array();
$i = 0;
foreach ($comments as $comment) {
$comment_array[$i++] = array('user_id' => $comment->user_id, 'politician_id' => $comment->politician_id, 'created_at' => $comment->created_at, 'content' => $comment->content, 'id' => $comment->id);
}
$i = 0;
foreach ($news as $article) {
$news_array[$i++] = array('id' => $article->id, 'headline' => $article->headline, 'source' => $article->source, 'content' => $article->content, 'feature_pic_url' => $article->feature_pic_url);
}
return View::make('main')->with('comments', $comment_array)->with('news', $news_array)->with('most_popular_politicians', $this->mostPopular())->with('issue_tag_cloud', $issue_tag_cloud);
}
示例13: edit
public function edit($id)
{
$issueID = $id;
$conditions = array('book_issue_id' => $issueID, 'return_time' => 0);
$log = Logs::where($conditions);
if (!$log->count()) {
throw new Exception('Invalid Book ID entered or book already returned');
} else {
$log = Logs::where($conditions)->firstOrFail();
$log_id = $log['id'];
$student_id = $log['student_id'];
$issue_id = $log['book_issue_id'];
DB::transaction(function () use($log_id, $student_id, $issue_id) {
// change log status by changing return time
$log_change = Logs::find($log_id);
$log_change->return_time = time();
$log_change->save();
// decrease student book issue counter
$student = Student::find($student_id);
$student->books_issued = $student->books_issued - 1;
$student->save();
// change issue availability status
$issue = Issue::find($issue_id);
$issue->available_status = 1;
$issue->save();
});
return 'Successfully returned';
}
}
示例14: edit
public function edit($id)
{
$student = Issue::find($id);
$menu = 'student';
return View::make('students.edit', compact('student', 'menu'));
}
示例15: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$issue = Issue::find($id);
if ($issue == NULL) {
throw new Exception('Invalid Book ID');
}
$issue->added_at_timestamp = date('d-M-y h:i A', strtotime($issue->added_at_timestamp));
$book = Books::find($issue->book_id);
$issue->book_name = $book->title;
$issue->author = $book->author;
$issue->category = Categories::find($book->category_id)->category;
$issue->available_status = (bool) $issue->available_status;
if ($issue->available_status == 1) {
return $issue;
}
$conditions = array('return_time' => 0, 'book_issue_id' => $id);
$book_issue_log = Logs::where($conditions)->take(1)->get();
foreach ($book_issue_log as $log) {
$student_id = $log->student_id;
}
$student_data = Student::find($student_id);
unset($student_data->email_id);
unset($student_data->books_issued);
unset($student_data->approved);
unset($student_data->rejected);
$student_branch = Branch::find($student_data->branch)->branch;
$roll_num = $student_data->roll_num . '/' . $student_branch . '/' . substr($student_data->year, 2, 4);
unset($student_data->roll_num);
unset($student_data->branch);
unset($student_data->year);
$student_data->roll_num = $roll_num;
$student_data->category = StudentCategories::find($student_data->category)->category;
$issue->student = $student_data;
return $issue;
}