本文整理汇总了PHP中Projects类的典型用法代码示例。如果您正苦于以下问题:PHP Projects类的具体用法?PHP Projects怎么用?PHP Projects使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Projects类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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'));
}
}
示例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>');
}
示例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');
}
}
示例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';
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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());
}
示例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
示例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;
}
示例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));
}
示例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));
}
示例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));
}
}
示例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
}