本文整理汇总了PHP中Project类的典型用法代码示例。如果您正苦于以下问题:PHP Project类的具体用法?PHP Project怎么用?PHP Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Project类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resources_handle_on_project_user_removed
/**
* Handle on_project_user_removed event
*
* @param Project $project
* @param User $user
* @return null
*/
function resources_handle_on_project_user_removed($project, $user)
{
$rows = db_execute('SELECT id FROM ' . TABLE_PREFIX . 'project_objects WHERE project_id = ?', $project->getId());
if (is_foreachable($rows)) {
$object_ids = array();
foreach ($rows as $row) {
$object_ids[] = (int) $row['id'];
}
// foreach
$user_id = $user->getId();
// Assignments cleanup
db_execute('DELETE FROM ' . TABLE_PREFIX . 'assignments WHERE user_id = ? AND object_id IN (?)', $user_id, $object_ids);
cache_remove('object_starred_by_' . $user_id);
cache_remove('object_assignments_*');
cache_remove('object_assignments_*_rendered');
// Starred objects cleanup
db_execute('DELETE FROM ' . TABLE_PREFIX . 'starred_objects WHERE user_id = ? AND object_id IN (?)', $user_id, $object_ids);
cache_remove('object_starred_by_' . $user_id);
// Subscriptions cleanup
db_execute('DELETE FROM ' . TABLE_PREFIX . 'subscriptions WHERE user_id = ? AND parent_id IN (?)', $user_id, $object_ids);
cache_remove('user_subscriptions_' . $user_id);
// remove pinned project
PinnedProjects::unpinProject($project, $user);
}
// if
}
示例2: display
function display()
{
$this->ev->process();
//echo "<!-- \n";
//var_dump($_REQUEST);
//var_dump($this->ev->fieldDefs);
//echo "-->";
if (empty($this->ev->focus->id) && $_REQUEST['return_relationship'] == 'projects_cases') {
$parent = new Project();
$parent->retrieve($_REQUEST['return_id']);
$accts = $parent->get_linked_beans('accounts', 'Account');
$i = 0;
$acctlist = array();
foreach ($accts as $acct) {
$acctlist[i] = $acct->id;
$i++;
}
if (isset($parent->facility_c) && $this->ev->fieldDefs['jobnumber_c']['value'] == "") {
$this->ev->fieldDefs['jobnumber_c']['value'] = $parent->jobnumber_c;
}
if ($i > 0 && $this->ev->fieldDefs['account_id']['value'] == "") {
$this->ev->fieldDefs['account_id']['value'] = $acct->id;
$this->ev->fieldDefs['account_name']['value'] = $acct->name;
}
}
echo $this->ev->display();
}
示例3: getProjects
/**
* Get the projects.
*
* @param int $Limit
* @return void
*/
protected function getProjects($limit = null)
{
$projects = $this->project->alphabetical()->take($limit)->get();
foreach ($projects as $project) {
Sitemap::addTag(route('projects.show', $project->slug), $project->updated_at, 'weekly', '0.8');
}
}
示例4: addUserAsProjectAdmin
public function addUserAsProjectAdmin(Project $project, PFUser $user)
{
$project_id = $this->da->escapeInt($project->getId());
$user_id = $this->da->escapeInt($user->getId());
$sql = "UPDATE user_group\n SET admin_flags = 'A'\n WHERE group_id = {$project_id}\n AND user_id = {$user_id}";
return $this->update($sql);
}
示例5: getDashboardItemData
public function getDashboardItemData()
{
$data = array();
$project = new Project();
$data['numberOfProjects'] = $project->Count("status = 'Active'");
return $data;
}
示例6: build
public function build(Project $project, $revision = null, $flags = 0, $callback = null)
{
// project already has a running build
if ($project->isBuilding() && Sismo::FORCE_BUILD !== ($flags & Sismo::FORCE_BUILD)) {
return;
}
$this->builder->init($project, $callback);
list($sha, $author, $date, $message) = $this->builder->prepare($revision, Sismo::LOCAL_BUILD !== ($flags & Sismo::LOCAL_BUILD));
$commit = $this->storage->getCommit($project, $sha);
// commit has already been built
if ($commit && $commit->isBuilt() && Sismo::FORCE_BUILD !== ($flags & Sismo::FORCE_BUILD)) {
return;
}
$commit = $this->storage->initCommit($project, $sha, $author, \DateTime::createFromFormat('Y-m-d H:i:s O', $date), $message);
$process = $this->builder->build();
if ($process->getExitCode() > 0) {
$commit->setStatusCode('failed');
$commit->setOutput(sprintf("[31mBuild failed[0m\n\n[33mOutput[0m\n%s\n\n[33m Error[0m%s", $process->getOutput(), $process->getErrorOutput()));
} else {
$commit->setStatusCode('success');
$commit->setOutput($process->getOutput());
}
$this->storage->updateCommit($commit);
if (Sismo::SILENT_BUILD !== ($flags & Sismo::SILENT_BUILD)) {
foreach ($project->getNotifiers() as $notifier) {
$notifier->notify($commit);
}
}
}
示例7: __construct
public function __construct(Project $project, $count, $selected)
{
$this->label = util_unconvert_htmlspecialchars($project->getPublicName());
$this->count = $count;
$this->value = $project->getGroupId();
$this->selected = $selected;
}
示例8: project
public static function project($project_ID = NULL, $create = false)
{
if (!$project_ID) {
global $ID;
$project_ID = getNS($ID);
}
if (isset(self::$projects[$project_ID])) {
return self::$projects[$project_ID];
}
$name = noNS($project_ID);
$project_file = DOKU_DATA . implode('/', explode(':', $project_ID)) . "/{$name}.project";
if (file_exists($project_file)) {
$project = unserialize(file_get_contents($project_file));
if (!method_exists($project, 'version') || $project->version() != PROJECTS_VERSION) {
$project = new Project($project_ID);
$project->rebuild();
}
} else {
if ($create) {
$project = new Project($project_ID);
} else {
return NULL;
}
}
self::$projects[$project_ID] = $project;
return $project;
}
示例9: buildRequest
/**
* @return Codendi_Request
*/
private function buildRequest(Project $project, SimpleXMLElement $xml_element)
{
$params['action'] = 'export';
$params['project_id'] = $project->getID();
$params['into_xml'] = $xml_element;
return new Codendi_Request($params);
}
示例10: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$userToken = Input::get('token');
$validation = Validator::make(['projectname' => Input::get('projectname'), 'description' => Input::get('description'), 'start_date' => Input::get('start_date'), 'end_date' => Input::get('end_date')], ['projectname' => 'required|min:4|max:40', 'description' => 'min:10|max:60', 'start_date' => 'required|date_format:"m/d/Y"', 'end_date' => 'required|date_format:"m/d/Y"']);
if ($validation->fails()) {
return Redirect::route('dashboard', array($userToken))->withErrors($validation);
} else {
$projectName = Input::get('projectname');
$projectDesc = Input::get('description');
$projectStart = Input::get('start_date');
$start_day = date("Y-m-d", strtotime($projectStart));
$projectEnd = Input::get('end_date');
$end_day = date("Y-m-d", strtotime($projectEnd));
$team_id = Input::get('team_id');
try {
$project = new Project();
$project->project_title = $projectName;
$project->project_desc = $projectDesc;
$project->team_id = $team_id;
$project->strat_date = $start_day;
$project->end_date = $end_day;
$project->save();
return Redirect::route('dashboard', array($userToken));
} catch (Exception $e) {
echo $e;
return 'Something is wrong!';
}
}
}
示例11: iterateSubProjects
private function iterateSubProjects(Project $project, $select, $value, $level = 0, $showmilestones = true)
{
$selected = $value == $project->id ? 'selected="selected"' : '';
$disabled = '';
if ($project->ismilestone) {
if (!$showmilestones) {
return "";
}
$disabled = $select == 'project' ? 'disabled="disabled"' : '';
} else {
$disabled = $select == 'milestone' ? 'disabled="disabled"' : '';
}
$prepend = '';
for ($i = 0; $i < $level; $i++) {
$prepend .= ' ';
}
if (isset($this->view->model->id) && $project->id == $this->view->model->id) {
$disabled = 'disabled="disabled"';
}
$html = '<option value="' . $project->id . '" ' . $disabled . ' ' . $selected . '>' . $prepend . $this->view->escape($project->title) . " (" . $project->id . ")" . '</option>';
$children = $project->getChildProjects();
foreach ($children as $childProject) {
$html .= "\n" . $this->iterateSubProjects($childProject, $select, $value, $level + 1);
}
return $html;
}
示例12: getMatchingArtifacts
public function getMatchingArtifacts(PFUser $user, Project $project, array $tracker_ids, Tracker_Hierarchy $hierarchy, Tracker_CrossSearch_Query $query, $excluded_artifact_ids = array())
{
$shared_fields = $this->shared_field_factory->getSharedFields($query->getSharedFields());
$semantic_fields = $query->getSemanticCriteria();
$artifacts_info = $this->dao->searchMatchingArtifacts($user, $project->getId(), $query, $tracker_ids, $shared_fields, $semantic_fields, $this->artifact_link_field_ids_for_column_display, $excluded_artifact_ids);
return $this->result_sorter->buildTreeWithMissingChildren($user, $artifacts_info, $excluded_artifact_ids);
}
示例13: getProject
public function getProject()
{
$buglist = $this->getBuglist();
$project = new Project();
$project->getByID($buglist->pr_id);
return $project;
}
示例14: getOpenTimeslotTasks
/**
* Return tasks on which the user has an open timeslot
*
* @param User $user
* @param Project $project
* @return array
*/
static function getOpenTimeslotTasks(User $user, User $logged_user, $project = null, $tag = null, $assigned_to_company = null, $assigned_to_user = null, $archived = false)
{
if ($project) {
$project_ids = $project->getAllSubWorkspacesQuery(!$archived);
$wsstring = " AND " . self::getWorkspaceString($project_ids);
} else {
$wsstring = "";
}
$openTimeslot = " AND id in (SELECT object_id from " . TABLE_PREFIX . "timeslots t WHERE user_id=" . $user->getId() . " AND t.object_manager='ProjectTasks' AND t.end_time='" . EMPTY_DATETIME . "')";
$permissions = ' AND ( ' . permissions_sql_for_listings(ProjectTasks::instance(), ACCESS_LEVEL_READ, logged_user(), 'project_id') . ')';
$tagStr = $tag ? " AND id in (SELECT rel_object_id from " . TABLE_PREFIX . "tags t WHERE tag=" . DB::escape($tag) . " AND t.rel_object_manager = 'ProjectTasks')" : '';
$assignedToStr = "";
if ($assigned_to_company) {
if ($assigned_to_company == -1) {
$assigned_to_company = 0;
}
$assignedToStr .= " AND `assigned_to_company_id` = " . DB::escape($assigned_to_company) . " ";
}
if ($assigned_to_user) {
if ($assigned_to_user == -1) {
$assigned_to_user = 0;
}
$assignedToStr .= " AND `assigned_to_user_id` = " . DB::escape($assigned_to_user) . " ";
}
if ($archived) {
$archived_cond = "`archived_by_id` <> 0 ";
} else {
$archived_cond = "`archived_by_id` = 0 ";
}
$objects = self::findAll(array('conditions' => array('`is_template` = false AND ' . $archived_cond . $wsstring . $permissions . $tagStr . $assignedToStr . $openTimeslot), 'order' => 'due_date ASC, `created_on` DESC'));
return $objects;
}
示例15: _new
public function _new()
{
parent::_new();
$this->setTemplateName('calls_new');
$projects = $opportunities = $activities = null;
if (isset($this->_data['person_id'])) {
$person = new Person();
$person->load($this->_data['person_id']);
$this->_data['company_id'] = $person->company_id;
$projects = $person->projects;
$opportunities = $person->opportunities;
$activities = $person->activities;
$this->view->set('person', $person->fullname);
}
if (isset($this->_data['company_id'])) {
$company = new Company();
$company->load($this->_data['company_id']);
$projects = DataObjectCollection::Merge($company->projects, $projects);
$opportunities = DataObjectCollection::Merge($company->opportunities, $opportunities);
$activities = DataObjectCollection::Merge($company->activities, $activities);
$this->view->set('company', $company->name);
}
if (isset($this->_data['project_id'])) {
$project = new Project();
$project->load($this->_data['project_id']);
$this->_data['company_id'] = $project->company_id;
}
$this->view->set('projects', $projects);
$this->view->set('opportunities', $opportunities);
$this->view->set('activities', $activities);
}