/**
 * 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
}
Example #2
0
 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();
 }
 /**
  * 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');
     }
 }
 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);
 }
 public function getDashboardItemData()
 {
     $data = array();
     $project = new Project();
     $data['numberOfProjects'] = $project->Count("status = 'Active'");
     return $data;
 }
Example #6
0
 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("Build failed\n\nOutput\n%s\n\n Error%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);
         }
     }
 }
 public function __construct(Project $project, $count, $selected)
 {
     $this->label = util_unconvert_htmlspecialchars($project->getPublicName());
     $this->count = $count;
     $this->value = $project->getGroupId();
     $this->selected = $selected;
 }
Example #8
0
 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;
 }
 /**
  * @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);
 }
 /**
  * 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!';
         }
     }
 }
Example #11
0
 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 .= '&nbsp;&nbsp;&nbsp;&nbsp;';
     }
     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;
 }
Example #12
0
 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);
 }
 /**
  * GET /projects
  * Get a listing of all projects.
  *
  * @return Response
  */
 public function index()
 {
     $projects = $this->project->latest()->paginate(25);
     $page = Input::get('page');
     $title = $page ? "All projects (Page {$page})" : 'All projects';
     return View::make('projects.index', compact('projects'))->withTitle($title);
 }
Example #14
0
 public function getProject()
 {
     $buglist = $this->getBuglist();
     $project = new Project();
     $project->getByID($buglist->pr_id);
     return $project;
 }
 /**
  * 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;
 }
 /**
  * Renders the chart
  * @param IUser $logged_user
  * @return string
  */
 function render(IUser $logged_user)
 {
     $db_result = DB::execute("SELECT milestone_id, COUNT(*) as count FROM " . TABLE_PREFIX . "project_objects WHERE project_id = ? AND type='Task' AND state >= ? AND visibility >= ? GROUP BY milestone_id", $this->project->getId(), STATE_VISIBLE, $logged_user->getMinVisibility());
     $array_result = $db_result instanceof DBResult ? $db_result->toArrayIndexedBy('milestone_id') : false;
     if (is_foreachable($array_result)) {
         $pie_chart = new PieChart('400px', '400px', 'milestone_eta_report_pie_chart_placeholder');
         $this->serie_array = array();
         $this->milestones = array();
         // Set data for the rest
         foreach ($array_result as $serie_data) {
             $point = new ChartPoint('1', $serie_data['count']);
             $serie = new ChartSerie($point);
             if (intval($serie_data['milestone_id'])) {
                 $milestone = new RemediaMilestone(intval($serie_data['milestone_id']));
                 $label = PieChart::makeShortForPieChart($milestone->getName());
                 $this->milestones[] = $milestone;
             } else {
                 $label = lang('No Milestone');
             }
             //if
             $serie->setOption('label', $label);
             $this->serie_array[] = $serie;
         }
         //foreach
         $pie_chart->addSeries($this->serie_array);
         return $pie_chart->render();
     } else {
         return '<p class="empty_slate">' . lang('There are no milestones in this project.') . '</p>';
     }
     //if
 }
Example #17
0
 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);
 }
Example #18
0
 public function display()
 {
     global $mod_strings;
     if ($_REQUEST['return_module'] == 'Project') {
         $project = new Project();
         $project->retrieve($_REQUEST['return_id']);
         //Get project resources (users & contacts)
         $resources1 = $project->get_linked_beans('project_users_1', 'User');
         $resources2 = $project->get_linked_beans('project_contacts_1', 'Contact');
         //sort into descending order
         ksort($resources1);
         ksort($resources2);
         echo "<script type='text/javascript'>";
         echo "var users = [];";
         echo "var contacts = [];";
         foreach ($resources1 as $user) {
             echo "var user = ['" . $user->id . "', '" . $user->name . "', 'User'];";
             echo "users.push(user);";
         }
         foreach ($resources2 as $contact) {
             echo "var user = ['" . $contact->id . "', '" . $contact->name . "', 'Contact'];";
             echo "contacts.push(user);";
         }
         echo "</script>";
     }
     parent::display();
 }
Example #19
0
 public function _new()
 {
     $flash = Flash::Instance();
     // ensure that a project id is specified for new notes
     if ($this->_data['action'] === 'new' && (!isset($this->_data['project_id']) || empty($this->_data['project_id']))) {
         $flash->addError('No project id specified');
         sendBack();
     }
     parent::_new();
     // load either a new project or the current note model to get the project name and id
     if ($this->_data['action'] === 'new') {
         $project = new Project();
         $project->load($this->_data['project_id']);
         $project_name = $project->name;
         $project_id = $project->id;
     } else {
         $model = $this->_uses[$this->modeltype];
         $project_name = $model->project;
         $project_id = $model->project_id;
     }
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Project', array('view_project' => array('tag' => $project_name, 'link' => array('module' => 'projects', 'controller' => 'projects', 'action' => 'view', 'id' => $project_id))));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
Example #20
0
 public function testManageClientTest()
 {
     // set the repository for the project
     $project = new Project();
     $project->Id = 3;
     $project->Fill();
     $project->AddRepositories(array('git://fake/repo.git'), array(''), array(''), array(''));
     // submit a mock machine config xml
     $machineDescription = dirname(__FILE__) . '/data/camelot.cdash.xml';
     $result = $this->uploadfile($this->url . '/submit.php?sitename=camelot.kitware&systemname=Ubuntu32&submitinfo=1', $machineDescription);
     if ($this->findString($result, 'error') || $this->findString($result, 'Warning') || $this->findString($result, 'Notice')) {
         $this->assertEqual($result, "\n");
         return false;
     }
     // schedule a job for the machine
     $this->login();
     $this->connect($this->url . '/manageClient.php?projectid=3');
     $scriptContents = 'message("hello world")';
     $this->setField('clientscript', $scriptContents);
     $this->clickSubmitByName('submit');
     // get the site id
     $siteid = $this->get($this->url . '/submit.php?sitename=camelot.kitware&systemname=Ubuntu32&getsiteid=1');
     // wait a few seconds so that we know we are ahead of the schedule time
     sleep(5);
     // verify that we receive the correct script when we query for a job
     $content = $this->get($this->url . '/submit.php?getjob=1&siteid=' . $siteid);
     if (!$this->findString($content, 'message("hello world")')) {
         $this->fail('Wrong script was sent: expected hello world script but got: ' . $content . ' for siteid=' . $siteid);
         return false;
     }
     $this->pass('Passed');
     return 0;
 }
Example #21
0
 public function testCRUD()
 {
     //CREATE Test
     $newProject = new Project();
     $projectName = 'This is a Test';
     $newProject->setAttributes(array('name' => $projectName, 'description' => 'This project is for test purpose only', 'start_date' => '2010-11-15 15:00:00', 'end_date' => '2010-12-06 00:00:00', 'update_user_id' => 1, 'category' => 2, 'status' => 1, 'owner' => 1));
     $this->assertTrue($newProject->save(false));
     //READ Test
     $readProject = Project::model()->findByPk($newProject->id);
     $this->assertTrue($readProject instanceof Project);
     $this->assertEquals($projectName, $readProject->name);
     //UPDATE Test
     $updateProjectName = 'Updated Name2';
     $newProject->name = $updateProjectName;
     $this->AssertTrue($newProject->save(false));
     $updatedProject = Project::model()->findByPk($newProject->id);
     $this->assertTrue($updatedProject instanceof Project);
     $this->assertNotEquals($projectName, $updatedProject->name);
     //DELETE Test
     $deletedProjectId = $newProject->id;
     $newProject->delete();
     $deletedProject = Project::model()->findByPk($newProject->id);
     $this->assertEquals(Null, $deletedProject);
     //GetUserVote Test
     $project = Project::model()->findByPk(18);
     $this->assertTrue($project->getUserVote(7) == true);
     //Vote Test
     $this->assertTrue($project->vote(1, 1) == 1);
 }
Example #22
0
 public function testIfSessionCanAddEntity()
 {
     $project = new Project();
     $project->setName('My Project');
     $this->session->addEntity($project);
     $this->assertTrue($this->session->isAdded($project));
 }
Example #23
0
/**
 * @return string
 */
function service_replace_template_name_in_link($link, array $template, Project $project)
{
    $link = preg_replace('#(/www/|/projects/|group=)' . $template['name'] . '(/|&|$)#', '$1' . $project->getUnixName() . '$2', $link);
    $link = preg_replace('/group_id=' . $template['id'] . '([^\\d]|$)/', 'group_id=' . $project->getGroupId() . '$1', $link);
    EventManager::instance()->processEvent(Event::SERVICE_REPLACE_TEMPLATE_NAME_IN_LINK, array('link' => &$link, 'template' => $template, 'project' => $project));
    return $link;
}
Example #24
0
 /**
  *
  * @param SmartyHelper $smartyHelper
  * @param Command $prj
  * @param int $userid
  */
 public static function dashboardSettings(SmartyHelper $smartyHelper, Project $prj, $userid, $teamid)
 {
     $pluginDataProvider = PluginDataProvider::getInstance();
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_ISSUE_SELECTION, $prj->getIssueSelection());
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_TEAM_ID, $teamid);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_SESSION_USER_ID, $userid);
     $team = TeamCache::getInstance()->getTeam($teamid);
     $startT = $team->getDate();
     $now = time();
     $endT = mktime(23, 59, 59, date('m', $now), date('d', $now), date('Y', $now));
     if ($startT > $endT) {
         $startT = strtotime('today midnight');
     }
     //echo "start $startT end $endT<br>";
     // Calculate a nice day interval
     $nbWeeks = ($endT - $startT) / 60 / 60 / 24;
     $interval = ceil($nbWeeks / 20);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_START_TIMESTAMP, $startT);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_END_TIMESTAMP, $endT);
     $pluginDataProvider->setParam(PluginDataProviderInterface::PARAM_INTERVAL, $interval);
     // save the DataProvider for Ajax calls
     $_SESSION[PluginDataProviderInterface::SESSION_ID] = serialize($pluginDataProvider);
     // create the Dashboard
     $dashboard = new Dashboard('Project' . $prj->getId());
     $dashboard->setDomain(IndicatorPluginInterface::DOMAIN_PROJECT);
     $dashboard->setCategories(array(IndicatorPluginInterface::CATEGORY_QUALITY, IndicatorPluginInterface::CATEGORY_ACTIVITY, IndicatorPluginInterface::CATEGORY_ROADMAP, IndicatorPluginInterface::CATEGORY_PLANNING, IndicatorPluginInterface::CATEGORY_RISK));
     $dashboard->setTeamid($teamid);
     $dashboard->setUserid($userid);
     $data = $dashboard->getSmartyVariables($smartyHelper);
     foreach ($data as $smartyKey => $smartyVariable) {
         $smartyHelper->assign($smartyKey, $smartyVariable);
     }
 }
Example #25
0
 public static function destroy($id)
 {
     self::check_logged_in();
     $project = new Project(array('id' => $id));
     $project->destroy();
     Redirect::to('/project', array('message' => 'Project removed successfully'));
 }
 public function getInitData($req)
 {
     $data = array();
     $employees = new Employee();
     $data['numberOfEmployees'] = $employees->Count("1 = 1");
     $company = new CompanyStructure();
     $data['numberOfCompanyStuctures'] = $company->Count("1 = 1");
     $user = new User();
     $data['numberOfUsers'] = $user->Count("1 = 1");
     $project = new Project();
     $data['numberOfProjects'] = $project->Count("status = 'Active'");
     $attendance = new Attendance();
     $data['numberOfAttendanceLastWeek'] = $attendance->Count("in_time > '" . date("Y-m-d H:i:s", strtotime("-1 week")) . "'");
     if (empty($data['numberOfAttendanceLastWeek'])) {
         $data['numberOfAttendanceLastWeek'] = 0;
     }
     $empLeave = new EmployeeLeave();
     $data['numberOfLeaves'] = $empLeave->Count("date_start > '" . date("Y-m-d") . "'");
     $timeEntry = new EmployeeTimeEntry();
     $data['numberOfAttendanceLastWeek'] = $timeEntry->Count("in_time > '" . date("Y-m-d H:i:s", strtotime("-1 week")) . "'");
     $candidate = new Candidate();
     $data['numberOfCandidates'] = $candidate->Count("1 = 1");
     $job = new Job();
     $data['numberOfJobs'] = $job->Count("status = 'Active'");
     $course = new Course();
     $data['numberOfCourses'] = $course->Count("1 = 1");
     return new IceResponse(IceResponse::SUCCESS, $data);
 }
Example #27
0
 public function testSetupRepositories()
 {
     $insight = new Project();
     $row = pdo_single_row_query("SELECT id FROM project where name='InsightExample'");
     $insight->Id = $row['id'];
     $insight->Fill();
     $insight->AddRepositories(array(':pserver:anoncvs@itk.org:/cvsroot/Insight'), array('anoncvs'), array(''), array(''));
     $insight->CTestTemplateScript = 'client testing works';
     $insight->Save();
     $pub = new Project();
     $row = pdo_single_row_query("SELECT id FROM project where name='PublicDashboard'");
     $pub->Id = $row['id'];
     $pub->Fill();
     $pub->AddRepositories(array('git://cmake.org/cmake.git'), array(''), array(''), array(''));
     $pub->CvsViewerType = 'gitweb';
     $pub->CvsUrl = 'cmake.org/gitweb?p=cmake.git';
     $pub->Save();
     $email = new Project();
     $row = pdo_single_row_query("SELECT id FROM project where name='EmailProjectExample'");
     $email->Id = $row['id'];
     $email->Fill();
     $email->AddRepositories(array('https://www.kitware.com/svn/CDash/trunk'), array(''), array(''), array(''));
     $pub->CvsViewerType = 'websvn';
     $email->CvsUrl = 'https://www.kitware.com/svn/CDash/trunk';
     $email->Save();
 }
 public function run()
 {
     try {
         // 共通設定取得
         $base_dir = dirname(__FILE__) . '/../';
         $config = new Config($base_dir);
         $debug = $config->get_param('debug');
         // レポート用オブジェクト
         $report = new Report($config);
         // メンバー一覧のオブジェクト
         $member = new Member($config);
         // 担当者マスターの差分を取得する。
         $member->get_diff();
         $this->mail_body .= $member->print_diff();
         // プロジェクト一覧のオブジェクト
         $project = new Project($config);
         // プロジェクトマスターの差分を取得する。
         $project->get_diff();
         $this->mail_body .= $project->print_diff();
         // 担当プロジェクトのオブジェクト
         $relation = new Relation($config);
         // 担当プロジェクトの差分を取得する。
         $relation->set_member($member);
         $relation->set_project($project);
         $relation->get_diff();
         $this->mail_body .= $relation->print_diff();
         // BackLogIDが入力されているにもかかわらず担当者名が未入力のデータを検出する。
         $this->mail_body .= $relation->validate();
         // 複数コンテンツ障害の配信先
         // 全社向け
         $multi_alert = new MultiAlert($config);
         $multi_alert->set_mode('all');
         $multi_alert->set_project($project);
         $multi_alert->set_member($member);
         $multi_alert->get_diff();
         $this->mail_body .= $multi_alert->print_diff();
         // コンテンツ事業部向け
         $multi_alert = new MultiAlert($config);
         $multi_alert->set_mode('contents');
         $multi_alert->set_project($project);
         $multi_alert->set_member($member);
         $multi_alert->get_diff();
         $this->mail_body .= $multi_alert->print_diff();
         // レポート
         $report->out($this->mail_body);
         // 古いファイルを削除
         Util::remove_old_file($config->get_param('data_dir'), $config->get_param('keep_file_days'));
     } catch (Exception $e) {
         $member->remove();
         $project->remove();
         $relation->remove();
         $multi_alert->remove();
         if ($debug) {
             print $e->getMessage() . PHP_EOL;
         } else {
             $report->out($e->getMessage());
         }
     }
 }
 /**
  * Get the parameters to redirect to proper pane on the AgileDashboard
  * @param Codendi_Request $request
  * @param Project $project
  * @return array || null
  */
 public function getRedirectToParameters(Codendi_Request $request, Project $project)
 {
     $request_parameters = $this->extractParametersFromRequest($request);
     if ($request_parameters) {
         $request_parameters['group_id'] = $project->getGroupId();
     }
     return $request_parameters;
 }
Example #30
0
 /**
  * @param string $reference  Fully qualified reference name ("refs/heads/master")
  * @param int    $permission Write or Admin permission (see self::*_PERMISSION)
  */
 public function isGranted(User $user, $reference, $permission)
 {
     $userRole = $this->project->getUserRole($user);
     if (!$userRole || !$userRole->isRole($this->role)) {
         return false;
     }
     return $this->matches($reference) && $this->verifyPermission($permission);
 }