本文整理汇总了PHP中Projects类的典型用法代码示例。如果您正苦于以下问题:PHP Projects类的具体用法?PHP Projects怎么用?PHP Projects使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Projects类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: actionChangeStatus
/**
* Change Case status using select-box
*/
public function actionChangeStatus()
{
// check if user has permissions to changeStatusCases
if (Yii::app()->user->checkAccess('changeStatusCases')) {
// verify is request was made via post ajax
if (Yii::app()->request->isAjaxRequest && isset($_POST)) {
// get Cases object model
$model = $this->loadModel($_REQUEST['id']);
// set new status
$model->status_id = $_POST['changeto'];
// validate and save
if ($model->save()) {
// save log
$attributes = array('log_date' => date("Y-m-d G:i:s"), 'log_activity' => 'CaseStatusChanged', 'log_resourceid' => $model->case_id, 'log_type' => Logs::LOG_UPDATED, 'user_id' => Yii::app()->user->id, 'module_id' => Yii::app()->controller->id, 'project_id' => $model->project_id);
Logs::model()->saveLog($attributes);
// create comment to let then know that some user change the case status
$modelComment = new Comments();
$modelComment->comment_date = date("Y-m-d G:i:s");
$modelComment->comment_text = Status::STATUS_COMMENT . ": " . $model->Status->status_id;
$modelComment->user_id = Yii::app()->user->id;
$modelComment->module_id = Modules::model()->find(array('condition' => 't.module_name = :module_name', 'params' => array(':module_name' => $this->getId())))->module_id;
$modelComment->comment_resourceid = $model->case_id;
$modelComment->save(false);
// prepare email template for each project manager
Yii::import('application.extensions.phpMailer.yiiPhpMailer');
$mailer = new yiiPhpMailer();
$subject = Yii::t('email', 'CaseStatusChange') . " - " . $model->case_name;
//$Users = Users::model()->with('Clients')->findManagersByProject($model->project_id);
$Users = Projects::model()->findAllUsersByProject($model->project_id);
$recipientsList = array();
foreach ($Users as $client) {
$recipientsList[] = array('name' => $client->CompleteName, 'email' => $client->user_email);
}
// load template
$str = $this->renderPartial('//templates/cases/StatusChanged', array('case' => $model, 'user' => Users::model()->findByPk(Yii::app()->user->id), 'urlToCase' => "http://" . $_SERVER['SERVER_NAME'] . Yii::app()->createUrl('cases/view', array('id' => $model->case_id)), 'typeNews' => $model->status_id == Status::STATUS_ACCEPTED || $model->status_id == Status::STATUS_TOREVIEW ? 'buenas' : 'malas', 'applicationName' => Yii::app()->name, 'applicationUrl' => "http://" . $_SERVER['SERVER_NAME'] . Yii::app()->request->baseUrl), true);
$mailer->pushMail($subject, $str, $recipientsList, Emails::PRIORITY_NORMAL);
$output = Yii::t('cases', 'StatusChanged');
} else {
$output = Yii::t('cases', 'StatusError');
}
echo $output;
Yii::app()->end();
} else {
throw new CHttpException(403, Yii::t('site', '403_Error'));
}
} else {
throw new CHttpException(403, Yii::t('site', '403_Error'));
}
}
开发者ID:lanzelotik,项目名称:celestic-community,代码行数:52,代码来源:CasesController.php
示例2: postProjects
public function postProjects()
{
$projects = new Projects();
$name = Input::get('inputName');
$technologies = Input::get('inputTechnologies');
$description = Input::get('inputDescription');
$created_at = date("Y-m-d H:i:s");
$updated_at = date("Y-m-d H:i:s");
$projects->insertProjects($name, $technologies, $description, $created_at, $updated_at);
return Redirect::to('about/projects')->with('message', '<div class="alert alert-dismissable alert-success">
<strong>Well done!</strong> Project added successfully.</div>');
}
开发者ID:shwetasabne,项目名称:laravelproject,代码行数:12,代码来源:AboutController.php
示例3: actionProfile
public function actionProfile()
{
$username = Yii::app()->Ini->v('user');
$current_user_id = 0;
$current_user_role = 0;
$model = Homeowners::model()->findByAttributes(array('username' => $username));
if (count($model) > 0) {
if (!Yii::app()->user->isGuest) {
$current_user_id = Yii::app()->user->getId();
$current_user_role = Yii::app()->user->role;
}
$criteria = new CDbCriteria();
$criteria->condition = "homeowner_id = " . $model->homeowner_id;
$criteria->limit = 8;
$this->pageTitle = 'Handyman.com - Homeowner - ' . $model->firstname . ' ' . $model->lastname . ' Profile';
$this->render('homeowner-profile', array('model' => $model, 'projects' => Projects::model()->findAll($criteria), 'current_user_id' => $current_user_id, 'current_user_role' => $current_user_role));
//update views
if (!Yii::app()->user->isGuest) {
$userid = Yii::app()->user->getId();
$role = Yii::app()->user->role;
$views = HomeownerViews::model()->findByAttributes(array('viewed_by' => $userid, 'homeowner_id' => $model->homeowner_id, 'viewed_user_type' => $role));
if (count($views) > 0) {
} else {
$views = new HomeownerViews();
$views->homeowner_id = $model->homeowner_id;
$views->viewed_by = $userid;
$views->viewed_user_type = $role;
$views->save();
}
}
} else {
$this->redirect(Yii::app()->homeUrl . 'home/error');
}
}
开发者ID:seph-krueger,项目名称:handyman,代码行数:34,代码来源:HomeownerController.php
示例4: 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
示例5: 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
示例6: 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
示例7: getProjectsCount
/**
* Return number of projects that are in this group
*
* @param void
* @return integer
*/
function getProjectsCount()
{
if ($this->projects_count === false) {
$this->projects_count = Projects::countByGroup($this);
}
// if
return $this->projects_count;
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:14,代码来源:ProjectGroup.class.php
示例8: beforeAction
public function beforeAction($action)
{
$o_db = Settings::model()->findAll();
foreach ($o_db as $item) {
$this->settings[$item->alias] = $item->value;
}
$this->project = Projects::model()->getProjectByDomain($_SERVER['HTTP_HOST']);
return parent::beforeAction($action);
}
开发者ID:CrystReal,项目名称:Site_frontend,代码行数:9,代码来源:MainController.php
示例9: 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
示例10: 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
示例11: __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
示例12: index
/**
* Mobile Access Homepage
*
*/
function index()
{
$pinned_project_ids = PinnedProjects::findProjectIdsByUser($this->logged_user);
if (is_foreachable($pinned_project_ids)) {
$pinned_projects = Projects::findByIds($pinned_project_ids);
} else {
$pinned_projects = null;
}
// if
$this->smarty->assign(array("pinned_projects" => $pinned_projects));
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:15,代码来源:MobileAccessController.class.php
示例13: actionStart
public function actionStart()
{
$model = new Projects();
// uncomment the following code to enable ajax-based validation
/*
if(isset($_POST['ajax']) && $_POST['ajax']==='projects-start-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
*/
if (isset($_POST['Projects'])) {
$model->attributes = $_POST['Projects'];
$model->creationDateTime = date('Y-m-d H:i:s');
if ($model->validate()) {
$model->save();
$this->redirect('industry/index');
}
}
$this->render('start', array('model' => $model));
}
开发者ID:Covert-Inferno,项目名称:prohd,代码行数:21,代码来源:IndustryController.php
示例14: getStatistics
/**
* Get all task waiting to solve
* By default project_id is selected
* @return model list of invoices statistics amounts
*/
public function getStatistics()
{
if (Yii::app()->user->getState('project_selected') != null) {
return Invoices::model()->getInvoicesStatistics(Yii::app()->user->getState('project_selected'));
} else {
$Projects = Projects::model()->findMyProjects(Yii::app()->user->id);
$projectList = array(0);
foreach ($Projects as $project) {
array_push($projectList, $project->project_id);
}
return Invoices::model()->getInvoicesStatistics(implode(",", $projectList));
}
}
开发者ID:lanzelotik,项目名称:celestic-community,代码行数:18,代码来源:InvoicesStatistics.php
示例15: 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
示例16: __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
示例17: 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
示例18: actionStatus
/**
* Change Project status action
*/
public function actionStatus()
{
if (Yii::app()->request->getParam('id') && ($model = Projects::model()->byUser()->findByPk(Yii::app()->request->getParam('id')))) {
// Check it's current status and update
$currentStatus = $model->status;
$model->status = $currentStatus == 0 ? 1 : 0;
// Add description to the activity
$model->activity['description'] = $model->status ? 'Project Activated.' : 'Project Archived.';
$model->update();
Functions::ajaxString($model->status ? Yii::t('projects', 'Project Activated.') : Yii::t('projects', 'Project Archived.'));
} else {
Functions::ajaxError(Yii::t('error', 'We could not find that project.'));
}
}
开发者ID:IuriiP,项目名称:yii-tracker,代码行数:17,代码来源:ProjectsController.php
示例19: getWorkspacesByTemplate
/**
* Returns all Workspaces an Template belongs to
*
* @param $object_manager
* @param $Template_id
* @return array
*/
static function getWorkspacesByTemplate($template_id, $wsCSV = null)
{
$all = self::findAll(array('conditions' => "`template_id` = {$template_id}" . ($wsCSV ? " AND `workspace_id` IN ({$wsCSV})" : '')));
if (!is_array($all)) {
return array();
}
$csv = "";
foreach ($all as $w) {
if ($csv != "") {
$csv .= ",";
}
$csv .= $w->getWorkspaceId();
}
return Projects::findByCSVIds($csv);
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:22,代码来源:WorkspaceTemplates.class.php
示例20: __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
注:本文中的Projects类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论