本文整理汇总了PHP中Project::current方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::current方法的具体用法?PHP Project::current怎么用?PHP Project::current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::current方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_index
/**
* Post a comment to a issue
*
* @return Redirect
*/
public function post_index()
{
if (!Input::get('comment')) {
return Redirect::to(Project\Issue::current()->to() . '#new-comment')->with('notice-error', 'You did not put in a comment!');
}
$comment = \Project\Issue\Comment::create_comment(Input::all(), Project::current(), Project\Issue::current());
return Redirect::to(Project\Issue::current()->to() . '#comment' . $comment->id)->with('notice', 'Your comment has been added!');
}
示例2: get_edit
/**
* Edit a issue
*
* @return View
*/
public function get_edit()
{
Asset::add('tag-it-js', '/app/assets/js/tag-it.min.js', array('jquery', 'jquery-ui'));
Asset::add('tag-it-css-base', '/app/assets/css/jquery.tagit.css');
Asset::add('tag-it-css-zendesk', '/app/assets/css/tagit.ui-zendesk.css');
/* Get tags as string */
$issue_tags = '';
foreach (Project\Issue::current()->tags as $tag) {
$issue_tags .= (!empty($issue_tags) ? ',' : '') . $tag->tag;
}
return $this->layout->nest('content', 'project.issue.edit', array('issue' => Project\Issue::current(), 'issue_tags' => $issue_tags, 'project' => Project::current()));
}
示例3: project_permission
/**
* Check to see if current user has permission to see project
*
* @param int $project_id
* @return bool
*/
public function project_permission($project_id = null)
{
if (is_null($project_id)) {
$project_id = Project::current()->id;
}
if ($this->permission('project-all')) {
return true;
}
if (Project\User::check_assign($this->id, $project_id)) {
return true;
}
return false;
}
示例4: post_edit
public function post_edit()
{
/* Delete the project */
if (Input::get('delete')) {
Project::delete_project(Project::current());
return Redirect::to('projects')->with('notice', __('tinyissue.project_has_been_deleted'));
}
/* Update the project */
$update = Project::update_project(Input::all(), Project::current());
if ($update['success']) {
return Redirect::to(Project::current()->to('edit'))->with('notice', __('tinyissue.project_has_been_updated'));
}
return Redirect::to(Project::current()->to('edit'))->with_errors($update['errors'])->with('notice-error', __('tinyissue.we_have_some_errors'));
}
示例5: post_edit
public function post_edit()
{
/* Delete the project */
if (Input::get('delete')) {
Project::delete_project(Project::current());
return Redirect::to('projects')->with('notice', 'The project has been deleted.');
}
/* Update the project */
$update = Project::update_project(Input::all(), Project::current());
if ($update['success']) {
return Redirect::to(Project::current()->to('edit'))->with('notice', 'Project has been updated!');
}
return Redirect::to(Project::current()->to('edit'))->with_errors($update['errors'])->with('notice-error', 'Whoops, we have some errors below.');
}
示例6: create_comment
/**
* Create a new comment
*
* @param array $input
* @param \Project $project
* @param \Project\Issue $issue
* @return Comment
*/
public static function create_comment($input, $project, $issue)
{
$fill = array('created_by' => \Auth::user()->id, 'project_id' => $project->id, 'issue_id' => $issue->id, 'comment' => $input['comment']);
$comment = new static();
$comment->fill($fill);
$comment->save();
/* Add to user's activity log */
\User\Activity::add(2, $project->id, $issue->id, $comment->id);
/* Add attachments to issue */
\DB::table('projects_issues_attachments')->where('upload_token', '=', $input['token'])->where('uploaded_by', '=', \Auth::user()->id)->update(array('issue_id' => $issue->id, 'comment_id' => $comment->id));
/* Update the project */
$issue->updated_at = date('Y-m-d H:i:s');
$issue->updated_by = \Auth::user()->id;
$issue->save();
/* Notify the person to whom the issue is currently assigned, unless that person is the one making the comment */
if ($issue->assigned_to && $issue->assigned_to != \Auth::user()->id) {
$project = \Project::current();
//$subject = 'Issue "' . $issue->title . '" in "' . $project->name . '" project has a new comment';
$subject = sprintf(__('email.new_comment'), $issue->title, $project->name);
$text = \View::make('email.commented_issue', array('actor' => \Auth::user()->firstname . ' ' . \Auth::user()->lastname, 'project' => $project, 'issue' => $issue, 'comment' => $comment->comment));
\Mail::send_email($text, $issue->assigned->email, $subject);
}
return $comment;
}
示例7: __
<td>
<input id="upload" type="file" name="file_upload" />
<ul id="uploaded-attachments"></ul>
</td>
</tr>
<tr>
<th></th>
<td><input type="submit" value="<?php
echo __('tinyissue.create_issue');
?>
" class="button primary" /></td>
</tr>
</table>
<?php
echo Form::hidden('session', Crypter::encrypt(Auth::user()->id));
?>
<?php
echo Form::hidden('project_id', Project::current()->id);
?>
<?php
echo Form::hidden('token', md5(Project::current()->id . time() . \Auth::user()->id . rand(1, 100)));
?>
<?php
echo Form::token();
?>
</form>
</div>
示例8:
?>
<a href="javascript:void(0);" onclick="remove_project_user(<?php
echo $row->id;
?>
, <?php
echo Project::current()->id;
?>
);" class="delete">Remove</a>
<?php
}
?>
<?php
echo $row->firstname . ' ' . $row->lastname;
?>
</li>
<?php
}
?>
</ul>
<?php
if (Auth::user()->permission('project-modify')) {
?>
<input type="text" id="add-user-project" placeholder="Assign a user" onmouseover="init_sidebar_autocomplete(<?php
echo Project::current()->id;
?>
);" />
<?php
}
示例9: function
Session::put('return', URI::current());
return Redirect::to('login');
}
});
Route::filter('ajax', function () {
if (!Request::ajax()) {
return Response::error('404');
}
});
Route::filter('project', function () {
// find project id from issue object
if (Request::route()->parameters[0] == 0) {
return;
}
Project::load_project(Request::route()->parameters[0]);
if (!Project::current()) {
return Response::error('404');
}
});
Route::filter('issue', function () {
Project\Issue::load_issue(Request::route()->parameters[1]);
if (!Project\Issue::current()) {
return Response::error('404');
}
// load project
if (Request::route()->parameters[0] == 0) {
Request::route()->parameters = array(Project\Issue::current()->project_id, Project\Issue::current()->id);
Project::load_project(Request::route()->parameters[0]);
}
});
Route::filter('permission', function ($permission) {
示例10: create_issue
/**
* Create a new issue
*
* @param array $input
* @param \Project $project
* @return Issue
*/
public static function create_issue($input, $project)
{
$rules = array('title' => 'required|max:200', 'body' => 'required');
$validator = \Validator::make($input, $rules);
if ($validator->fails()) {
return array('success' => false, 'errors' => $validator->errors);
}
$fill = array('created_by' => \Auth::user()->id, 'project_id' => $project->id, 'title' => $input['title'], 'body' => $input['body'], 'status' => 1);
if (\Auth::user()->permission('issue-modify')) {
$fill['assigned_to'] = $input['assigned_to'];
}
$issue = new static();
$issue->fill($fill);
$issue->save();
/* Create tags */
$issue->set_tags('create');
/* Add to user's activity log */
\User\Activity::add(1, $project->id, $issue->id);
/* Add attachments to issue */
\DB::table('projects_issues_attachments')->where('upload_token', '=', $input['token'])->where('uploaded_by', '=', \Auth::user()->id)->update(array('issue_id' => $issue->id));
/* Notify the person being assigned to. */
/* If no one is assigned, notify all users who are assigned to this project and who have permission to modify the issue. */
/* Do not notify the person creating the issue. */
if ($issue->assigned_to) {
if ($issue->assigned_to != \Auth::user()->id) {
$project = \Project::current();
//$subject = 'New issue "' . $issue->title . '" was submitted to "' . $project->name . '" project and assigned to you';
$subject = sprintf(__('email.assignment'), $issue->title, $project->name);
$text = \View::make('email.new_assigned_issue', array('project' => $project, 'issue' => $issue));
\Mail::send_email($text, $issue->assigned->email, $subject);
}
} else {
$project = \Project::current();
foreach ($project->users()->get() as $row) {
if ($row->id != \Auth::user()->id && $row->permission('project-modify')) {
//$subject = 'New issue "' . $issue->title . '" was submitted to "' . $project->name . '" project';
$subject = sprintf(__('email.new_issue'), $issue->title, $project->name);
$text = \View::make('email.new_issue', array('project' => $project, 'issue' => $issue));
\Mail::send_email($text, $row->email, $subject);
}
}
}
/* Return success and issue object */
return array('success' => true, 'issue' => $issue);
}
示例11: __
?>
<div class="dropdown">
<ul>
<li class="unassigned"><a href="javascript:void(0);" onclick="issue_assign_change(0, <?php
echo Project\Issue::current()->id;
?>
);" class="user0<?php
echo !Project\Issue::current()->assigned ? ' assigned' : '';
?>
"><?php
echo __('tinyissue.no_one');
?>
</a></li>
<?php
foreach (Project::current()->users()->get() as $row) {
?>
<li><a href="javascript:void(0);" onclick="issue_assign_change(<?php
echo $row->id;
?>
, <?php
echo Project\Issue::current()->id;
?>
);" class="user<?php
echo $row->id;
echo Project\Issue::current()->assigned && $row->id == Project\Issue::current()->assigned->id ? ' assigned' : '';
?>
"><?php
echo $row->firstname . ' ' . $row->lastname;
?>
</a></li>
示例12: __
>
<a href="<?php
echo Project::current()->to('issues');
?>
?tags=status:closed">
<?php
echo $closed_count == 1 ? '1 ' . __('tinyissue.closed_issue') : $closed_count . ' ' . __('tinyissue.closed_issues');
?>
</a>
</li>
<li <?php
echo $active == 'assigned' ? 'class="active"' : '';
?>
>
<a href="<?php
echo Project::current()->to('issues');
?>
?tags=status:open&assigned_to=<?php
echo Auth::user()->id;
?>
">
<?php
echo $assigned_count == 1 ? '1 ' . __('tinyissue.issue_assigned_to_you') : $assigned_count . ' ' . __('tinyissue.issues_assigned_to_you');
?>
</a>
</li>
</ul>
<div class="inside-tabs">
<?php
echo $page;
示例13: __
>
<a href="<?php
echo Project::current()->to('issues');
?>
?status=0">
<?php
echo $closed_count == 1 ? '1 ' . __('tinyissue.closed_issue') : $closed_count . ' ' . __('tinyissue.closed_issues');
?>
</a>
</li>
<li <?php
echo $active == 'assigned' ? 'class="active"' : '';
?>
>
<a href="<?php
echo Project::current()->to('assigned');
?>
?status=1">
<?php
echo $assigned_count == 1 ? '1 ' . __('tinyissue.issue_assigned_to_you') : $assigned_count . ' ' . __('tinyissue.issues_assigned_to_you');
?>
</a>
</li>
</ul>
<div class="inside-tabs">
<?php
echo $page;
?>
</div>
示例14:
>
<a href="<?php
echo Project::current()->to('issues');
?>
?status=0">
<?php
echo $closed_count == 1 ? '1 Closed Issue' : $closed_count . ' Closed Issues';
?>
</a>
</li>
<li <?php
echo $active == 'assigned' ? 'class="active"' : '';
?>
>
<a href="<?php
echo Project::current()->to('issues/assigned');
?>
?status=1">
<?php
echo $assigned_count == 1 ? '1 Issue Assigned to you' : $assigned_count . ' Issues assigned to you';
?>
</a>
</li>
</ul>
<div class="inside-tabs">
<?php
echo $page;
?>
</div>
示例15: get_edit
/**
* Edit a issue
*
* @return View
*/
public function get_edit()
{
return $this->layout->nest('content', 'project.issue.edit', array('issue' => Project\Issue::current(), 'project' => Project::current()));
}