当前位置: 首页>>代码示例>>PHP>>正文


PHP Projects::findById方法代码示例

本文整理汇总了PHP中Projects::findById方法的典型用法代码示例。如果您正苦于以下问题:PHP Projects::findById方法的具体用法?PHP Projects::findById怎么用?PHP Projects::findById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Projects的用法示例。


在下文中一共展示了Projects::findById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: source_handle_on_frequently

/**
 * Daily update of repositories
 *
 * @param null
 * @return void
 */
function source_handle_on_frequently()
{
    require_once ANGIE_PATH . '/classes/xml/xml2array.php';
    $results = 'Repositories updated: ';
    $repositories = Repositories::findByUpdateType(REPOSITORY_UPDATE_FREQUENTLY);
    foreach ($repositories as $repository) {
        // don't update projects other than active ones
        $project = Projects::findById($repository->getProjectId());
        if ($project->getStatus() !== PROJECT_STATUS_ACTIVE) {
            continue;
        }
        // if
        $repository->loadEngine();
        $repository_engine = new RepositoryEngine($repository, true);
        $last_commit = $repository->getLastCommit();
        $revision_to = is_null($last_commit) ? 1 : $last_commit->getRevision() + 1;
        $logs = $repository_engine->getLogs($revision_to);
        if (!$repository_engine->has_errors) {
            $repository->update($logs['data']);
            $total_commits = $logs['total'];
            $results .= $repository->getName() . ' (' . $total_commits . ' new commits); ';
            if ($total_commits > 0) {
                $repository->sendToSubscribers($total_commits, $repository_engine);
                $repository->createActivityLog($total_commits);
            }
            // if
        }
        // if
    }
    // foreach
    return is_foreachable($repositories) && count($repositories) > 0 ? $results : 'No repositories for frequently update';
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:38,代码来源:on_frequently.php

示例2: getProject

 /**
  * Return project instance
  *
  * @param void
  * @return Project
  */
 function getProject()
 {
     if ($this->project === false) {
         $this->project = Projects::findById($this->getProjectId());
     }
     // if
     return $this->project;
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:14,代码来源:Invoice.class.php

示例3: getProject

 /**
  * Return project part of the relationship
  *
  * @param void
  * @return Project
  */
 function getProject()
 {
     if (is_null($this->project)) {
         $this->project = Projects::findById($this->getProjectId());
     }
     // if
     return $this->project;
 }
开发者ID:ukd1,项目名称:Project-Pier,代码行数:14,代码来源:ProjectCompany.class.php

示例4: add_chart

	/**
	 * Show reporting index page
	 *
	 * @param void
	 * @return null
	 */
	function add_chart() {
		if (logged_user()->isGuest()) {
			flash_error(lang('no access permissions'));
			ajx_current("empty");
			return;
		}
		$factory = new ProjectChartFactory();
		$types = $factory->getChartTypes();

		$chart_data = array_var($_POST, 'chart');
		if(!is_array($chart_data)) {
			$chart_data = array(
				'type_id' => 1,
				'display_id' => 20,
				'show_in_project' => 1,
				'show_in_parents' => 0
			); // array
		} // if
		tpl_assign('chart_data', $chart_data);


		if (is_array(array_var($_POST, 'chart'))) {
			$project = Projects::findById(array_var($chart_data, 'project_id'));
			if (!$project instanceof Project) {
				flash_error(lang('project dnx'));
				ajx_current("empty");
				return;
			}
			$chart = $factory->getChart(array_var($chart_data, 'type_id'));
			$chart->setDisplayId(array_var($chart_data, 'display_id'));
			$chart->setTitle(array_var($chart_data, 'title'));

			if (array_var($chart_data, 'save') == 1){
				$chart->setFromAttributes($chart_data);

				try {
					DB::beginWork();
					$chart->save();
					$chart->setProject($project);
					DB::commit();
					flash_success(lang('success add chart', $chart->getTitle()));
					ajx_current('back');
				} catch(Exception $e) {
					DB::rollback();
					flash_error($e->getMessage());
					ajx_current("empty");
				}
				return;
			}

			$chart->ExecuteQuery();
			tpl_assign('chart', $chart);
			ajx_replace(true);
		}
		tpl_assign('chart_displays', $factory->getChartDisplays());
		tpl_assign('chart_list', $factory->getChartTypes());
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:63,代码来源:ReportingController.class.php

示例5: getInObject

	/**
	 * This function will return application data object that matches action and in object ID
	 *
	 * @param void
	 * @return ApplicationDataObject
	 */
	function getInObject() {
		if(is_null($this->in_object)) {
			if($this->getAction() == self::ADD_COMMENT_ACTION) {
				$this->in_object = ProjectMessages::findById($this->getInObjectId());
			} elseif($this->getAction() == self::ADD_TASK_ACTION) {
				$this->in_object = Projects::findById($this->getInObjectId());
			} // if
		} // if
		return $this->in_object;
	} // getInObject
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:16,代码来源:ProjectForm.class.php

示例6: __construct

 /**
  * Construct PublicSubmitAdminController
  * 
  * @param string $request
  * @return PublicSubmitAdminController
  *
  */
 function __construct($request)
 {
     parent::__construct($request);
     $this->smarty->assign(array("public_submit_settings_url" => assemble_url('admin_settings_public_submit')));
     if (!(extension_loaded('gd') || extension_loaded('gd2')) || !function_exists('imagefttext')) {
         $this->gd_loaded = false;
     }
     // if
     $this->smarty->assign(array('public_submit_url' => assemble_url('public_submit'), 'public_submit_enabled' => ConfigOptions::getValue('public_submit_enabled'), 'public_submit_captcha_enabled' => ConfigOptions::getValue('public_submit_enable_captcha'), 'public_submit_project' => Projects::findById(ConfigOptions::getValue('public_submit_default_project')), 'gd_loaded' => $this->gd_loaded));
     return $this;
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:18,代码来源:PublicSubmitAdminController.class.php

示例7: initActiveProject

 /**
  * Init active project, if we have active_project $_GET var
  *
  * @access public
  * @param void
  * @return null
  * @throws Error
  */
 private function initActiveProject()
 {
     $project_id = array_var($_GET, 'active_project');
     if (!empty($project_id)) {
         $project = Projects::findById($project_id);
         if (!$project instanceof Project) {
             throw new Error(lang('failed to load project'));
         }
         // if
         $this->setProject($project);
     }
     // if
 }
开发者ID:swenson,项目名称:projectpier,代码行数:21,代码来源:CompanyWebsite.class.php

示例8: __construct

 /**
  * Constructor
  *
  * @param Request $request
  * @return MobileAccessController extends ApplicationController 
  */
 function __construct($request)
 {
     parent::__construct($request);
     $this->disableCategories();
     $project_id = $this->request->get('project_id');
     if ($project_id) {
         $this->active_project = Projects::findById($project_id);
     }
     // if
     if (!instance_of($this->active_project, 'Project')) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     if (!$this->logged_user->isProjectMember($this->active_project)) {
         $this->httpError(HTTP_ERR_FORBIDDEN);
     }
     // if
     if ($this->active_project->getType() == PROJECT_TYPE_SYSTEM) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     $this->project_sections = array();
     $this->project_sections[] = array("name" => "overview", "full_name" => lang("Overview"), "url" => assemble_url('mobile_access_view_project', array('project_id' => $this->active_project->getId())));
     if (module_loaded('discussions') && $this->logged_user->getProjectPermission('discussion', $this->active_project)) {
         $this->project_sections[] = array("name" => "discussions", "full_name" => lang("Discussions"), "url" => assemble_url('mobile_access_view_discussions', array('project_id' => $this->active_project->getId())));
     }
     if (module_loaded('milestones') && $this->logged_user->getProjectPermission('milestone', $this->active_project)) {
         $this->project_sections[] = array("name" => "milestones", "full_name" => lang("Milestones"), "url" => assemble_url('mobile_access_view_milestones', array('project_id' => $this->active_project->getId())));
     }
     if (module_loaded('files') && $this->logged_user->getProjectPermission('file', $this->active_project)) {
         $this->project_sections[] = array("name" => "files", "full_name" => lang("Files"), "url" => assemble_url('mobile_access_view_files', array('project_id' => $this->active_project->getId())));
     }
     if (module_loaded('checklists') && $this->logged_user->getProjectPermission('checklist', $this->active_project)) {
         $this->project_sections[] = array("name" => "checklists", "full_name" => lang("Checklists"), "url" => assemble_url('mobile_access_view_checklists', array('project_id' => $this->active_project->getId())));
     }
     if (module_loaded('pages') && $this->logged_user->getProjectPermission('page', $this->active_project)) {
         $this->project_sections[] = array("name" => "pages", "full_name" => lang("Pages"), "url" => assemble_url('mobile_access_view_pages', array('project_id' => $this->active_project->getId())));
     }
     if (module_loaded('tickets') && $this->logged_user->getProjectPermission('ticket', $this->active_project)) {
         $this->project_sections[] = array("name" => "tickets", "full_name" => lang("Tickets"), "url" => assemble_url('mobile_access_view_tickets', array('project_id' => $this->active_project->getId())));
     }
     if (module_loaded('timetracking') && $this->logged_user->getProjectPermission('timerecord', $this->active_project)) {
         $this->project_sections[] = array("name" => "timetracking", "full_name" => lang("Time"), "url" => assemble_url('mobile_access_view_timerecords', array('project_id' => $this->active_project->getId())));
     }
     if (module_loaded('source') && $this->logged_user->getProjectPermission('repository', $this->active_project)) {
         $this->project_sections[] = array("name" => "source", "full_name" => lang("Repositories"), "url" => assemble_url('mobile_access_view_repositories', array('project_id' => $this->active_project->getId())));
     }
     //if($this->active_project->isLoaded() && $this->enable_categories) {
     $this->addBreadcrumb(lang('Project'), assemble_url('mobile_access_view_project', array("project_id" => $this->active_project->getId())));
     $this->smarty->assign(array("page_title" => $this->active_project->getName(), "active_project" => $this->active_project, "project_sections" => $this->project_sections, "page_breadcrumbs" => $this->breadcrumbs, "active_project_section" => 'overview', "active_category" => $this->active_category));
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:57,代码来源:MobileAccessProjectController.class.php

示例9: set_responsible_status

 function set_responsible_status()
 {
     $project_id = $this->request->getId('project_id');
     if ($project_id) {
         $project = Projects::findById($project_id);
     }
     $ticket_id = $this->request->getId('ticket_id');
     if ($ticket_id) {
         $ticket = Tickets::findByTicketId($project, $ticket_id);
     }
     $owner = Assignments::findOwnerByObject($ticket);
     $users = Assignments::findAssigneesByObject($ticket);
     $this->smarty->assign(array('project' => $project, 'ticket' => $ticket, 'users' => $users, 'owner' => $owner, 'ticket_url' => assemble_url('project_ticket', array('project_id' => $project_id, 'ticket_id' => $ticket_id))));
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:14,代码来源:AssignmentsController.class.php

示例10: __construct

 /**
  * Class constructor
  *
  */
 function __construct($repository, $triggered_by_handler = false)
 {
     parent::__construct();
     // check if we have neccessary resources
     if (instance_of($repository, 'Repository')) {
         $this->active_repository = $repository;
         $this->active_project = Projects::findById($repository->getProjectId());
     }
     // if
     $this->executable_path = with_slash(ConfigOptions::getValue('source_svn_path'));
     $config_dir = ConfigOptions::getValue('source_svn_config_dir');
     $this->config_dir = is_null($config_dir) ? '' : '--config-dir ' . $config_dir;
     $this->stderr2stdout = ConfigOptions::getValue('source_svn_use_output_redirect') == true ? "2>&1" : "";
     $this->trust_server_certificate = ConfigOptions::getValue('source_svn_trust_server_cert') == true ? '--trust-server-cert' : '';
     $this->triggerred_by_handler = $triggered_by_handler;
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:20,代码来源:subversion.class.php

示例11: getGroupTitle

function getGroupTitle($field, $tsRow)
{
    $ts = $tsRow["ts"];
    switch ($field) {
        case 'id':
            if ($ts->getObjectManager() == 'Projects') {
                return $ts->getObject()->getName();
            } else {
                return $ts->getObject()->getTitle();
            }
        case 'user_id':
            return Users::getUserDisplayName($ts->getUserId());
        case 'project_id_0':
            return $tsRow["wsId0"] != 0 ? Projects::findById($tsRow["wsId0"])->getName() : '';
        case 'project_id_1':
            return $tsRow["wsId1"] != 0 ? Projects::findById($tsRow["wsId1"])->getName() : '';
        case 'project_id_2':
            return $tsRow["wsId2"] != 0 ? Projects::findById($tsRow["wsId2"])->getName() : '';
        case 'priority':
            if ($ts->getObjectManager() == 'ProjectTasks') {
                switch ($ts->getObject()->getPriority()) {
                    case 100:
                        return lang('low priority');
                    case 200:
                        return lang('normal priority');
                    case 300:
                        return lang('high priority');
                    case 400:
                        return lang('urgent priority');
                    default:
                        return $ts->getObject()->getPriority();
                }
            } else {
                return lang('not applicable');
            }
        case 'milestone_id':
            if ($ts->getObjectManager() == 'ProjectTasks') {
                return $ts->getObject()->getMilestoneId() != 0 ? $ts->getObject()->getMilestone()->getTitle() : '';
            } else {
                return '';
            }
    }
    return '';
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:44,代码来源:total_task_times.php

示例12: form_run

 function form_run()
 {
     if ($this->request->isAsyncCall()) {
         $project = $this->request->get('project_id') ? Projects::findById($this->request->get('project_id')) : null;
         if ($project instanceof Project) {
             // TODO: eliminare group_by
             $report = new MilestoneETAReport($project);
             $this->response->assign('rendered_report_result', $report->render($this->logged_user));
             $this->response->assign('milestones', $report->getMilestones());
             $this->response->assign('detailed_report', true);
         } else {
             $this->response->notFound();
         }
         // if
     } else {
         $this->response->badRequest();
     }
     //if
 }
开发者ID:NaszvadiG,项目名称:ACModules,代码行数:19,代码来源:FrossoEstimatedCostReportsController.class.php

示例13: __construct

 /**
  * Construct method
  *
  * @param string $request
  * @return PublicSubmitController
  */
 function __construct($request)
 {
     parent::__construct($request);
     if (!ConfigOptions::getValue('public_submit_enabled')) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     $this->setLayout(array("module" => PUBLIC_SUBMIT_MODULE, "layout" => 'wireframe'));
     $this->active_project = Projects::findById(ConfigOptions::getValue('public_submit_default_project'));
     if (!instance_of($this->active_project, 'Project')) {
         $this->httpError(HTTP_ERR_NOT_FOUND);
     }
     // if
     // check if captcha is enabled, and if it is, check that GD library is loaded
     $this->captcha_enabled = (bool) ConfigOptions::getValue('public_submit_enable_captcha');
     if ($this->captcha_enabled) {
         if (!(extension_loaded('gd') || extension_loaded('gd2')) || !function_exists('imagefttext')) {
             $this->captcha_enabled = false;
         }
         // if
     }
     // if
     $this->smarty->assign(array("active_project" => $this->active_project, "submit_ticket_url" => assemble_url('public_submit'), 'captcha_enabled' => $this->captcha_enabled));
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:30,代码来源:PublicSubmitController.class.php

示例14: total_task_times_vs_estimate_comparison

 function total_task_times_vs_estimate_comparison($report_data = null, $task = null)
 {
     $this->setTemplate('report_wrapper');
     if (!$report_data) {
         $report_data = array_var($_POST, 'report');
     }
     $workspace = Projects::findById(array_var($report_data, 'project_id'));
     if ($workspace instanceof Project) {
         if (array_var($report_data, 'include_subworkspaces')) {
             $workspacesCSV = $workspace->getAllSubWorkspacesQuery(false);
         } else {
             $workspacesCSV = $workspace->getId();
         }
     } else {
         $workspacesCSV = null;
     }
     $start = getDateValue(array_var($report_data, 'start_value'));
     $end = getDateValue(array_var($report_data, 'end_value'));
     $st = $start->beginningOfDay();
     $et = $end->endOfDay();
     $st = new DateTimeValue($st->getTimestamp() - logged_user()->getTimezone() * 3600);
     $et = new DateTimeValue($et->getTimestamp() - logged_user()->getTimezone() * 3600);
     $timeslots = Timeslots::getTimeslotsByUserWorkspacesAndDate($st, $et, 'ProjectTasks', null, $workspacesCSV, array_var($report_data, 'task_id', 0));
     tpl_assign('timeslots', $timeslots);
     tpl_assign('workspace', $workspace);
     tpl_assign('start_time', $st);
     tpl_assign('end_time', $et);
     tpl_assign('user', $user);
     tpl_assign('post', $report_data);
     tpl_assign('template_name', 'total_task_times');
     tpl_assign('title', lang('task time report'));
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:32,代码来源:ReportingController.class.php

示例15: byproject

 /**
  * List all time total for a project (both billed and unbilled)
  *
  * @access public
  * @param void
  * @return null
  */
 function byproject()
 {
     $this->setLayout('administration');
     if (!logged_user()->isAdministrator(owner_company())) {
         flash_error(lang('no access permissions'));
         $this->redirectTo('dashboard');
     }
     // if
     $project_id = (int) array_var($_GET, 'id', 0);
     if ($project_id < 0) {
         $project_id = 0;
     }
     $redirect_to = array_var($_GET, 'redirect_to');
     if ($redirect_to == '') {
         $redirect_to = get_url('time', 'byproject', array('id' => $project_id));
         $redirect_to = str_replace('&amp;', '&', trim($redirect_to));
     }
     // if
     $unbilled = ProjectTimes::getTimeByProjectStatus(Projects::findById($project_id));
     $billed = ProjectTimes::getTimeByProjectStatus(Projects::findById($project_id), 1);
     tpl_assign('unbilled', $unbilled);
     tpl_assign('billed', $billed);
     tpl_assign('project', Projects::findById($project_id));
     tpl_assign('redirect_to', $redirect_to);
     $this->setSidebar(get_template_path('index_sidebar', 'time'));
 }
开发者ID:469306621,项目名称:Languages,代码行数:33,代码来源:TimeController.class.php


注:本文中的Projects::findById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。