public static function display_stylesheets() { $links = array(); if (self::$caching === true || is_array(self::$caching) && in_array(ProjectHelper::env(), self::$caching)) { foreach (self::$stylesheets as $media => $files) { $css_file = '/css/cache/' . substr(md5(serialize($files)), 0, 10) . '.css'; self::check_cache($files, 'css'); $links[] = '<link rel="stylesheet" href="/css/cache/' . self::cache_name($files) . '.css" type="text/css" media="' . $media . '" charset="utf-8" />'; } } else { $links = self::stylesheet_links(); } return implode("\n", $links); }
public static function check_environment() { if ($_SERVER['SERVER_ADDR'] == '127.0.0.1') { self::$environment = 'development'; } else { if (strpos($_SERVER['DOCUMENT_ROOT'], '/development/') !== false) { self::$environment = 'development'; } elseif (strpos($_SERVER['DOCUMENT_ROOT'], '/staging/') !== false) { self::$environment = 'staging'; } else { self::$environment = 'production'; } } return self::$environment; }
public static function GetLocationsFromTaskLocations(\Library\User $user, $sessionTask) { $matches = array(); $sessionProject = ProjectHelper::GetCurrentSessionProject($user); foreach ($sessionProject[\Library\Enums\SessionKeys::ProjectLocations] as $location) { foreach ($sessionTask[\Library\Enums\SessionKeys::TaskLocations] as $task_location) { if (intval($location->location_id()) === intval($task_location->location_id())) { array_push($matches, $location); break; } } } return $matches; }
public static function StoreSessionTask($user, $list, $sessionProject = NULL) { $SessionTasks = array(); $project = $sessionProject === NULL ? ProjectHelper::GetCurrentSessionProject($user) : $sessionProject; $countActiveTask = 0; foreach ($list as $task) { $key = \Library\Enums\SessionKeys::TaskKey . $task->task_id(); $sessionTask = self::MakeSessionTask($task); $SessionTasks[$key] = $sessionTask; array_push($project[\Library\Enums\SessionKeys::ProjectTasks], $key); if ($task->task_active()) { $countActiveTask += 1; $currentSessionTask = $sessionTask; //Get sessin task object } } ProjectHelper::SetUserSessionProject($user, $project); self::SetSessionTasks($user, $SessionTasks); if ($countActiveTask === 1) { //Set current task if there is only one active self::SetCurrentSessionTask($user, $currentSessionTask); } return $SessionTasks; }
/** * @return boolean */ public function allowViewProject() { $projectID = Yii::app()->request->getParam('id'); return ProjectHelper::accessViewProject($projectID); }
<?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . '/inc/env.php')) { include $_SERVER['DOCUMENT_ROOT'] . '/inc/env.php'; } // ============= // = Constants = // ============= define('ROOT', $_SERVER['DOCUMENT_ROOT']); define('PROJECT_NAME', 'toolbox'); // define('GA_ACCTNUM', 'UA-*******-*'); // ======================== // = Database Information = // ======================== switch (ProjectHelper::env()) { case 'development': define('DB_HOST', 'localhost'); define('DB_USER', 'cobalt_toolbox'); define('DB_PASS', 'psswd123'); define('DB_NAME', 'cobalt_toolbox'); break; case 'production': define('DB_HOST', $_ENV['DATABASE_SERVER']); define('DB_USER', $_ENV['DB_USER']); define('DB_PASS', $_ENV['DB_PASS']); define('DB_NAME', $_ENV['DB_NAME']); break; } if (@$db_load !== false) { include ROOT . '/inc/opendb.php'; }
<a href="#!" class="fullScreen"><?php echo Yii::t('main', 'Full screen'); ?> </a> <?php $this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array(array('name' => 'user_id', 'value' => CHtml::encode($model->user->name)), array('name' => 'description'), array('name' => '', 'type' => 'raw', 'value' => CHtml::link(Yii::t('main', 'Update Project'), array('update', 'id' => $model->id)) . ' ' . CHtml::link(Yii::t('main', 'Delete Project'), array('delete', 'id' => $model->id), array('onclick' => 'return confirm("' . Yii::t('main', '?') . '")')))))); ?> <h3><?php echo Yii::t('main', 'Diagram'); ?> </h3> <?php $this->widget('application.widgets.GhantProject', array('projectID' => $model->getPrimaryKey(), 'readonly' => !ProjectHelper::accessEditProject($model->getPrimaryKey()))); ?> <script type="text/javascript"> $(function(){ console.log(1); function checkFullScreen() { if($.cookie('fullscreen') == 1) { $('#page').addClass('fullscreen'); } else { $('#page').removeClass('fullscreen'); } } $('.fullScreen').click(function(){ $.cookie('fullscreen', $('#page').hasClass('fullscreen') ? 0 : 1); checkFullScreen(); return false;
/** * * @return boolean */ public function allowOnlyAdmin() { return ProjectHelper::currentUserIsAdmin(); }
public static function AddProjectAnalyte($caller, \Applications\PMTool\Models\Dao\Field_analyte $analyte, $dataPost) { $sessionProject = ProjectHelper::GetCurrentSessionProject($caller->user()); $project = $sessionProject[\Library\Enums\SessionKeys::ProjectObject]; $projectAnalyte = new \Applications\PMTool\Models\Dao\Project_field_analyte(); $dal = $caller->managers()->getManagerOf($caller->module()); $projectAnalyte->setProject_id($project->project_id()); $projectAnalyte->setField_analyte_id($analyte->field_analyte_id()); $result = $dal->add($projectAnalyte); if ($result >= 0) { self::AddTaskAnalyte($caller, $projectAnalyte, $dataPost); } else { throw new \Exception("Project field data wasn't added for following field data => \n\r" . var_dump($analyte), $result, NULL); } }
/** * * @param int $pid Project ID * @param type $editing * @param type $gantt_mode */ public function actionProcessor($pid, $editing = '', $gantt_mode = '') { $ids = isset($_POST['ids']) ? explode(',', $_POST['ids']) : array(); foreach ($ids as $id) { //check access if (!ProjectHelper::accessEditProject($pid, $id)) { $this->xmlOutputError('Error access', $id); continue; } $data = $this->loadDataByID($id); $status = isset($data['!nativeeditor_status']) ? $data['!nativeeditor_status'] : ''; $methodName = 'ghant_' . $gantt_mode . $status; if (method_exists($this, $methodName)) { call_user_func_array(array($this, $methodName), array($id, $data, $pid)); } else { $this->xmlOutputError('Method not found [' . $methodName . ']', $id); } } $this->xmlOutputFlush(); }
public static function GetAndStoreProjectServices($caller, $sessionProject) { $sessionProjects = $caller->user()->getAttribute(\Library\Enums\SessionKeys::UserSessionProjects); $projectService = new \Applications\PMTool\Models\Dao\Project_service(); $projectService->setProject_id($sessionProject[\Library\Enums\SessionKeys::ProjectObject]->project_id()); // if (!(count($sessionProject[\Library\Enums\SessionKeys::ProjectServices]) > 0)) { $dal = $caller->managers()->getManagerOf("ProjectService"); $sessionProject[\Library\Enums\SessionKeys::ProjectServices] = $dal->selectMany($projectService, "project_id"); // } ProjectHelper::SetUserSessionProject($caller->user(), $sessionProject); ProjectHelper::SetCurrentSessionProject($caller->user(), $sessionProject); return self::GetServicesFromProjectServices($caller->user(), $sessionProject); }