コード例 #1
0
 public function _new()
 {
     $resource = $this->_uses[$this->modeltype];
     if (!$resource->isLoaded()) {
         if (empty($this->_data['project_id'])) {
             $project = new Project();
             $projects = $project->getAll();
             $project_id = key($projects);
         } else {
             $project_id = $this->_data['project_id'];
         }
         $this->view->set('project_id', $project_id);
         $tasks = $this->getTaskList($project_id);
         $dates = $this->getStartEndDate($project_id);
         $this->view->set('start_date', $dates['start_date']['data']);
         $this->view->set('end_date', $dates['end_date']['data']);
     } else {
         $tasks = $this->getTaskList($resource->project_id);
     }
     $this->view->set('tasks', $tasks);
     $person = new Person();
     $cc = new ConstraintChain();
     $cc->add(new Constraint('company_id', '=', COMPANY_ID));
     $this->view->set('people', $person->getAll($cc));
     parent::_new();
 }
コード例 #2
0
ファイル: home.inc.php プロジェクト: Bremaweb/streber-1
/**
* render home view @ingroup pages
*/
function home()
{
    global $PH;
    global $auth;
    ### create from handle ###
    $PH->defineFromHandle(array());
    $page = new Page();
    $page->cur_tab = 'home';
    $page->options = build_home_options();
    $page->title = __("Today");
    # $auth->cur_user->name;
    $page->type = __("At Home");
    $page->title_minor = renderTitleDate(time());
    ### page functions ###
    $page->add_function(new PageFunction(array('target' => 'personEdit', 'params' => array('person' => $auth->cur_user->id), 'icon' => 'edit', 'name' => __('Edit your Profile'))));
    $page->add_function(new PageFunction(array('target' => 'personAllItemsViewed', 'params' => array('person' => $auth->cur_user->id), 'icon' => 'edit', 'name' => __('Mark all items as viewed'))));
    echo new PageHeader();
    echo new PageContentOpen_Columns();
    measure_stop('init2');
    require_once confGet('DIR_STREBER') . 'db/class_company.inc.php';
    $block = new PageBlock(array('title' => __('Active projects'), 'id' => 'projects'));
    $block->render_blockStart();
    echo "<div class=linklist>";
    /**
     * get companies
     */
    foreach (Company::getAll() as $c) {
        /**
         * get project for company
         *
         * @NOTE single sql requests are not the fastes solution here...
         */
        if ($projects = Project::getAll(array('order_by' => 'c.name', 'company' => $c->id))) {
            echo "<span class=sub>" . __("for", "short for client") . '</span> <b>' . $c->getLink() . "</b>:";
            echo '<ul>';
            foreach ($projects as $project) {
                echo '<li>' . $PH->getLink('projView', $project->name, array('prj' => $project->id)) . '</li>';
            }
            echo '</ul>';
        }
    }
    if ($projects = Project::getAll(array('order_by' => 'c.name', 'company' => 0))) {
        echo __("without client");
        echo '<ul>';
        foreach ($projects as $project) {
            echo '<li>' . $PH->getLink('projView', $project->name, array('prj' => $project->id)) . '</li>';
        }
        echo '</ul>';
    }
    echo "</div>";
    $block->render_blockEnd();
    echo new PageContentNextCol();
    if ($projects = Project::getAll(array('order_by' => 'modified DESC'))) {
        require_once confGet('DIR_STREBER') . 'lists/list_recentchanges.inc.php';
        printRecentChanges($projects);
    }
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
 public function setUp()
 {
     parent::setUp();
     $this->super = User::getByUsername('super');
     Yii::app()->user->userModel = $this->super;
     $projects = Project::getAll();
     $this->project = $projects[0];
 }
コード例 #4
0
ファイル: controller.php プロジェクト: joebo/dreamfish
 public static function index()
 {
     $projects = Project::getAll();
     set('user', dfUser::getCurrentName());
     set('projects', $projects);
     $myProjects = ProjectController::getMyProjects($projects);
     set('myProjects', $myProjects);
     output('/projects/index.html.php');
 }
コード例 #5
0
 static function find($search_id)
 {
     $found_project = null;
     $projects = Project::getAll();
     foreach ($projects as $project) {
         if ($project->getId() == $search_id) {
             $found_project = $project;
         }
     }
     return $found_project;
 }
コード例 #6
0
ファイル: HourController.php プロジェクト: radicaldesigns/gtd
 function show($params)
 {
     if (!$params['id']) {
         bail('Required $params["id"] not present.');
     }
     $d = $this->data;
     $d->hour = new Hour($params['id']);
     $d->estimate = new Estimate($d->hour->get('estimate_id'));
     $d->project = new Project($d->estimate->get('project_id'));
     $d->new_hour = new Hour();
     $d->new_hour->set(array('estimate_id' => $params['id'], 'staff_id' => Session::getUserId(), 'date' => date('Y-m-d')));
     $d->projects = Project::getAll();
     $d->new_estimate = new Estimate();
     $d->new_estimate->set(array('project_id' => $d->project->id));
 }
コード例 #7
0
 public function testSimpleUserImportWhereAllRowsSucceed()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $import = new Import();
     $serializedData['importRulesType'] = 'Projects';
     $serializedData['firstRowIsHeaderRow'] = true;
     $import->serializedData = serialize($serializedData);
     $this->assertTrue($import->save());
     ImportTestHelper::createTempTableByFileNameAndTableName('projectsSample.csv', $import->getTempTableName(), true, Yii::getPathOfAlias('application.modules.projects.tests.unit.files'));
     $this->assertEquals(3, ImportDatabaseUtil::getCount($import->getTempTableName()));
     // includes header rows.
     $ownerColumnMappingData = array('attributeIndexOrDerivedType' => 'owner', 'type' => 'importColumn', 'mappingRulesData' => array('DefaultModelNameIdMappingRuleForm' => array('defaultModelId' => null), 'UserValueTypeModelAttributeMappingRuleForm' => array('type' => UserValueTypeModelAttributeMappingRuleForm::ZURMO_USERNAME)));
     $mappingData = array('column_0' => $ownerColumnMappingData, 'column_1' => ImportMappingUtil::makeStringColumnMappingData('name'), 'column_2' => ImportMappingUtil::makeTextAreaColumnMappingData('description'), 'column_3' => ImportMappingUtil::makeDropDownColumnMappingData('status'));
     $importRules = ImportRulesUtil::makeImportRulesByType('Projects');
     $page = 0;
     $config = array('pagination' => array('pageSize' => 50));
     //This way all rows are processed.
     $dataProvider = new ImportDataProvider($import->getTempTableName(), true, $config);
     $dataProvider->getPagination()->setCurrentPage($page);
     $importResultsUtil = new ImportResultsUtil($import);
     $messageLogger = new ImportMessageLogger();
     ImportUtil::importByDataProvider($dataProvider, $importRules, $mappingData, $importResultsUtil, new ExplicitReadWriteModelPermissions(), $messageLogger);
     $importResultsUtil->processStatusAndMessagesForEachRow();
     //Confirm that 2 models where created.
     $projects = Project::getAll();
     $this->assertEquals(2, count($projects));
     $projects = Project::getByName('My first project');
     $this->assertEquals(1, count($projects[0]));
     $this->assertEquals('super', $projects[0]->owner->username);
     $this->assertEquals('My first project', $projects[0]->name);
     $this->assertEquals(2, $projects[0]->status);
     //todo ask Jason for it
     //$this->assertEquals('My first project Desc',   $projects[0]->description);
     $projects[0]->delete();
     $projects = Project::getByName('My second project');
     $this->assertEquals(1, count($projects[0]));
     $this->assertEquals('super', $projects[0]->owner->username);
     $this->assertEquals('My second project', $projects[0]->name);
     $this->assertEquals(1, $projects[0]->status);
     //$this->assertEquals('My second project Desc',  $projects[0]->description);
     $projects[0]->delete();
     //Confirm that 2 rows were processed as 'updated'.
     $this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::UPDATED));
     //Confirm 2 rows were processed as 'errors'.
     $this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR));
     $beansWithErrors = ImportDatabaseUtil::getSubset($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR);
     $this->assertEquals(0, count($beansWithErrors));
 }
コード例 #8
0
 public function _new()
 {
     parent::_new();
     $budget = $this->_uses[$this->modeltype];
     if (!$budget->isLoaded()) {
         if (!empty($this->_data['project_id'])) {
             $budget->project_id = $this->_data['project_id'];
         }
         $budget->budget_item_type = key($budget->getEnumOptions('budget_item_type'));
     }
     if (is_null($budget->project_id)) {
         $project = new Project();
         $projects = $project->getAll();
         $this->view->set('projects', $projects);
         $project_id = key($projects);
     } else {
         $project_id = $budget->project_id;
     }
     $this->view->set('tasks', $this->getTaskList($project_id));
     $this->view->set('items', $this->getBudgetItemList($budget->budget_item_type));
 }
コード例 #9
0
ファイル: person.inc.php プロジェクト: Bremaweb/streber-1
/**
* Edit a person  @ingroup pages
*/
function personEdit($person = NULL)
{
    global $PH;
    global $auth;
    ### new object not in database ###
    if (!$person) {
        $id = getOnePassedId('person', 'people_*');
        # WARNS if multiple; ABORTS if no id found
        if (!($person = Person::getEditableById($id))) {
            $PH->abortWarning("ERROR: could not get Person");
            return;
        }
    }
    ### validate rights ###
    if ($auth->cur_user->id == $person->id && $auth->cur_user->user_rights & RIGHT_PERSON_EDIT_SELF || $auth->cur_user->user_rights & RIGHT_PERSON_EDIT || $auth->cur_user->user_rights & RIGHT_PERSON_CREATE && $person->id == 0) {
        $pass = true;
    } else {
        $PH->abortWarning(__("not allowed to edit"), ERROR_RIGHTS);
    }
    $page = new Page(array('use_jscalendar' => true, 'autofocus_field' => 'person_name'));
    $page->cur_tab = 'people';
    $page->type = __('Edit Person', 'Page type');
    $page->title = $person->name;
    $page->title_minor = '';
    $page->crumbs = build_person_crumbs($person);
    $page->options = array(new NaviOption(array('target_id' => 'personEdit')));
    echo new PageHeader();
    echo new PageContentOpen();
    ### form background ###
    $block = new PageBlock(array('id' => 'person_edit'));
    $block->render_blockStart();
    require_once confGet('DIR_STREBER') . 'render/render_form.inc.php';
    global $g_pcategory_names;
    $form = new PageForm();
    $form->button_cancel = true;
    $form->add($person->fields['name']->getFormElement($person));
    ### profile and login ###
    if ($auth->cur_user->user_rights & RIGHT_PERSON_EDIT_RIGHTS || $auth->cur_user->user_rights & RIGHT_PERSON_CREATE && $auth->cur_user->user_rights & RIGHT_PROJECT_ASSIGN && $person->id == 0) {
        /**
         * if checkbox not rendered, submit might reset $person->can_login.
         * ...be sure the user_rights match
         */
        $form->add(new Form_checkbox("person_can_login", __('Person with account (can login)', 'form label'), $person->can_login));
    }
    $form->add($tab_group = new Page_TabGroup());
    $tab_group->add($tab = new Page_Tab("account", __("Account")));
    $fnick = $person->fields['nickname']->getFormElement($person);
    if ($person->can_login) {
        $fnick->required = true;
    }
    $tab->add($fnick);
    $tab->add($person->fields['office_email']->getFormElement($person));
    ### show password-fields if can_login ###
    /**
     * since the password as stored as md5-hash, we can initiate current password,
     * but have have to make sure the it is not changed on submit
     */
    $fpw1 = new Form_password('person_password1', __('Password', 'form label'), "__dont_change__", $person->fields['password']->tooltip);
    if ($person->can_login) {
        $fpw1->required = true;
    }
    $tab->add($fpw1);
    $fpw2 = new Form_password('person_password2', __('confirm Password', 'form label'), "__dont_change__", $person->fields['password']->tooltip);
    if ($person->can_login) {
        $fpw2->required = true;
    }
    $tab->add($fpw2);
    ### authentication ###
    if (confGet('LDAP')) {
        $authentication = array('streber' => 0, 'ldap' => 1);
        $tab->add(new Form_Dropdown('person_auth', __("Authentication with", "form label"), $authentication, $person->ldap));
    }
    ### profile and login ###
    if ($auth->cur_user->user_rights & RIGHT_PERSON_EDIT_RIGHTS) {
        global $g_user_profile_names;
        global $g_user_profiles;
        ### display "undefined" profile if rights changed ###
        # will be skipped when submitting
        $profile_num = $person->profile;
        $reset = "";
        if (!($default_rights = $g_user_profiles[$profile_num]['default_user_rights'])) {
            trigger_error("undefined/invalid profile requested ({$profile_num})", E_USER_ERROR);
        }
        $list = $g_user_profile_names;
        if ($default_rights != $person->user_rights) {
            $profile_num = '-1';
            $list['-1'] = __('-- reset to...--');
        }
        $tab->add(new Form_Dropdown('person_profile', __("Profile", "form label"), array_flip($list), $profile_num));
    }
    $a = array(sprintf(__('ASAP'), -1) => -1, sprintf(__('daily'), 1) => 1, sprintf(__('each 3 days'), 3) => 3, sprintf(__('each 7 days'), 7) => 7, sprintf(__('each 14 days'), 14) => 14, sprintf(__('each 30 days'), 30) => 30, __('Never') => 0);
    $p = $person->notification_period;
    if (!$person->settings & USER_SETTING_NOTIFICATIONS) {
        $p = 0;
    }
    $tab->add(new Form_Dropdown('person_notification_period', __("Send notifications", "form label"), $a, $p));
    #$tab->add(new Form_checkbox("person_html_mail",__('Send mail as html','form label'),$person->settings & USER_SETTING_HTML_MAIL));
    if ($person->id == 0) {
        $prj_num = '-1';
        $prj_names = array();
        $prj_names['-1'] = __('- no -');
        ## get all projects ##
        if ($projects = Project::getAll()) {
            foreach ($projects as $p) {
                $prj_names[$p->id] = $p->name;
            }
            ## assigne new person to ptoject ##
            $tab->add(new Form_Dropdown('assigned_prj', __('Assigne to project', 'form label'), array_flip($prj_names), $prj_num));
        }
    }
    $tab_group->add($tab = new Page_Tab("details", __("Details")));
    ### category ###
    if ($p = get('perscat')) {
        $perscat = $p;
    } else {
        $perscat = $person->category;
    }
    $tab->add(new Form_Dropdown('pcategory', __('Category', 'form label'), array_flip($g_pcategory_names), $perscat));
    $tab->add($person->fields['mobile_phone']->getFormElement($person));
    $tab->add($person->fields['office_phone']->getFormElement($person));
    $tab->add($person->fields['office_fax']->getFormElement($person));
    $tab->add($person->fields['office_street']->getFormElement($person));
    $tab->add($person->fields['office_zipcode']->getFormElement($person));
    $tab->add($person->fields['office_homepage']->getFormElement($person));
    $tab->add($person->fields['personal_email']->getFormElement($person));
    $tab->add($person->fields['personal_phone']->getFormElement($person));
    $tab->add($person->fields['personal_fax']->getFormElement($person));
    $tab->add($person->fields['personal_street']->getFormElement($person));
    $tab->add($person->fields['personal_zipcode']->getFormElement($person));
    $tab->add($person->fields['personal_homepage']->getFormElement($person));
    $tab->add($person->fields['birthdate']->getFormElement($person));
    $tab_group->add($tab = new Page_Tab("description", __("Description")));
    $e = $person->fields['description']->getFormElement($person);
    $e->rows = 20;
    $tab->add($e);
    $tab_group->add($tab = new Page_Tab("options", __("Options")));
    $tab->add(new Form_checkbox("person_enable_efforts", __('Enable efforts'), $person->settings & USER_SETTING_ENABLE_EFFORTS));
    $tab->add(new Form_checkbox("person_enable_bookmarks", __('Enable bookmarks'), $person->settings & USER_SETTING_ENABLE_BOOKMARKS));
    global $g_theme_names;
    if (count($g_theme_names) > 1) {
        $tab->add(new Form_Dropdown('person_theme', __("Theme", "form label"), array_flip($g_theme_names), $person->theme));
    }
    global $g_languages;
    $tab->add(new Form_Dropdown('person_language', __("Language", "form label"), array_flip($g_languages), $person->language));
    global $g_time_zones;
    $tab->add(new Form_Dropdown('person_time_zone', __("Time zone", "form label"), $g_time_zones, $person->time_zone));
    ### effort-style ###
    $effort_styles = array(__("start times and end times") => 1, __("duration") => 2);
    $effort_style = $person->settings & USER_SETTING_EFFORTS_AS_DURATION ? 2 : 1;
    $tab->add(new Form_Dropdown('person_effort_style', __("Log Efforts as"), $effort_styles, $effort_style));
    $tab->add(new Form_checkbox("person_filter_own_changes", __('Filter own changes from recent changes list'), $person->settings & USER_SETTING_FILTER_OWN_CHANGES));
    if (confGet('INTERNAL_COST_FEATURE') && $auth->cur_user->user_rights & RIGHT_VIEWALL && $auth->cur_user->user_rights & RIGHT_EDITALL) {
        $tab_group->add($tab = new Page_Tab("internal", __("Internal")));
        $tab->add($person->fields['salary_per_hour']->getFormElement($person));
    }
    ### temp uid for account activation ###
    if ($tuid = get('tuid')) {
        $form->add(new Form_Hiddenfield('tuid', '', $tuid));
    }
    ### create another person ###
    if ($auth->cur_user->user_rights & RIGHT_PERSON_CREATE && $person->id == 0) {
        #$form->add(new Form_checkbox("create_another","",));
        $checked = get('create_another') ? 'checked' : '';
        $form->form_options[] = "<span class=option><input id='create_another' name='create_another' class='checker' type=checkbox {$checked}><label for='create_another'>" . __("Create another person after submit") . "</label></span>";
    }
    #echo "<input type=hidden name='person' value='$person->id'>";
    $form->add(new Form_HiddenField('person', '', $person->id));
    echo $form;
    $PH->go_submit = 'personEditSubmit';
    ### pass company-id? ###
    if ($c = get('company')) {
        echo "<input type=hidden name='company' value='{$c}'>";
    }
    $block->render_blockEnd();
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
コード例 #10
0
ファイル: recentUpdates.php プロジェクト: hapebe/filecopy
<?php

require_once "../path.inc.php";
require $CONFIG_FILE;
require $LIB_PATH . "functions.lib.php";
require $LIB_PATH . "datetime.lib.php";
require $PATH . "lib/filecopy.lib.php";
$networkPathTranslations = array("D:/projects" => "\\\\chronos\\projects", "D:/public" => "\\\\chronos\\public", "D:/media" => "\\\\chronos\\media", "D:/install" => "\\\\chronos\\install", "D:/angebote" => "\\\\chronos\\angebote", "D:/ina" => "\\\\chronos\\ina");
// echo var_export($_GET, true);
// fetch projects from DB:
$projects = Project::getAll();
$projectFiles = array();
foreach ($projects as $uid => $dummy) {
    $projectFiles[$uid] = array();
}
$recentDays = 60;
$recentTime = makeDBDate(time() - $recentDays * 24 * 60 * 60);
$sql = "SELECT fileid FROM files " . "WHERE extension IN ('ppt','pptx','doc','docx','xls','xlsx','csv','pdf','zip','txt','sav') " . " AND status='C' " . " AND mtime > '" . $recentTime . "' " . "ORDER BY mtime DESC " . "LIMIT 0,1000;";
// warn($sql);
$result = @mysql_query($sql);
if (!$result) {
    errlog(__FILE__ . "@" . __LINE__ . ": " . mysql_error() . " ( SQL = " . $sql . ")");
}
while ($row = mysql_fetch_array($result)) {
    $fileid = $row["fileid"];
    $f = new BackupFile($fileid);
    foreach ($projects as $uid => $project) {
        if (strpos($f->path, $project->path) !== false) {
            // gotcha!
            $projectFiles[$uid][] = $f;
        }
コード例 #11
0
ファイル: ProjectTest.php プロジェクト: r-hills/live_test
 function test_getIncompleteStep()
 {
     //Arrange
     $name = "Learn to speak French";
     $motivation = "To travel";
     $due_date = "2015-10-10";
     $priority = 1;
     $test_project = new Project($name, $motivation, $due_date, $priority);
     $test_project->save();
     $description = "Buy a beret";
     $project_id = $test_project->getId();
     $position = 1;
     $test_step = new Step($description, $project_id, $position);
     $test_step->save();
     $description2 = "Eat French bread";
     $position2 = 2;
     $test_step2 = new Step($description2, $project_id, $position2);
     $test_step2->save();
     $description3 = "Watch Julia Childs";
     $position3 = 3;
     $test_step3 = new Step($description3, $project_id, $position3);
     $test_step3->save();
     //Act
     $test_step2->updateComplete(1);
     $result = Project::getAll();
     //Assert
     $this->assertEquals([$test_step, $test_step3], $result[0]->getIncompleteSteps());
 }
コード例 #12
0
function getProjectsAllWrapper()
{
    $data = Project::getAll(App::getClient());
    print json_encode($data);
}
コード例 #13
0
ファイル: task_more.inc.php プロジェクト: Bremaweb/streber-1
/**
* Edit note on person
*
* @ingroup pages
*/
function taskNoteOnPersonEdit($task = NULL, $person = NULL)
{
    global $PH;
    global $auth;
    global $g_pub_level_names;
    global $g_prio_names;
    if (!$task) {
        $id = getOnePassedId('tsk');
        if (!($task = Task::getEditableById($id))) {
            $PH->abortWarning(__("Select a note to edit"), ERROR_NOTE);
            return;
        }
    }
    ## get person ##
    if (!$person) {
        $pid = getOnePassedId('person');
        if (!($person = Person::getById($pid))) {
            $PH->abortWarning(__("ERROR: could not get Person"), ERROR_NOTE);
            return;
        }
    }
    $page = new Page(array('use_jscalendar' => false, 'autofocus_field' => 'task_name'));
    $page->cur_tab = 'people';
    if ($person->id) {
        $page->crumbs = build_person_crumbs($person);
    }
    $page->crumbs[] = new NaviCrumb(array('target_id' => 'taskNoteOnPersonEdit'));
    $page->type = __("Note");
    if (!$task->id) {
        $page->title = __('Create new note');
        $page->title_minor = __('Edit');
        ## default title ##
        $date = gmdate("Y-m-d", time());
        $time = getGMTString();
        $dt = $date . " " . renderTime($time);
        $task->name = sprintf(__("New Note on %s, %s"), $person->name, $dt);
    }
    ## eventually needed later when note is a subcategory of task
    /*else {
          $page->title=$task->name;
          $page->title_minor=$task->short;
      }*/
    echo new PageHeader();
    echo new PageContentOpen();
    require_once confGet('DIR_STREBER') . 'render/render_form.inc.php';
    $form = new PageForm();
    $form->button_cancel = true;
    ## name field ##
    $form->add($task->fields['name']->getFormElement($task));
    ## description field ##
    $e = $task->fields['description']->getFormElement($task);
    $e->rows = 22;
    $form->add($e);
    ### public-level drop down menu ###
    $form->add(new Form_Dropdown('task_pub_level', __("Publish to", "Form label"), array_flip($g_pub_level_names), $task->pub_level));
    ## priority drop down menu##
    $form->add(new Form_Dropdown('task_prio', __("Prio", "Form label"), array_flip($g_prio_names), $task->prio));
    if ($task->id == 0) {
        $proj_select = 0;
    }
    $p_list = array();
    $count = 1;
    $p_projects = $person->getProjects();
    $num = count($p_projects);
    if ($num > 0) {
        $p_list[0] = __('Assigned Projects');
        foreach ($p_projects as $pp) {
            $p_list[$pp->id] = "- " . $pp->name;
            $count++;
        }
    }
    $p_companies = $person->getCompanies();
    $num = count($p_companies);
    if ($num > 0) {
        $p_list['-1'] = __('Company Projects');
        foreach ($p_companies as $pcs) {
            $c_id = $pcs->id;
            $c_projects = Project::getAll(array('company' => $c_id));
            $count2 = 0;
            foreach ($c_projects as $cp) {
                $p_list[$cp->id] = "- " . $cp->name;
            }
        }
    }
    if (!($projects = Project::getAll(array('order_by' => 'name ASC')))) {
    } else {
        $p_list['-2'] = __('All other Projects');
        foreach ($projects as $pj) {
            $p_list[$pj->id] = "- " . $pj->name;
        }
    }
    $form->add(new Form_Dropdown('project', __('For Project', 'form label'), array_flip($p_list), $proj_select, "id='proj_list'"));
    ## new project ##
    if ($task->id == 0) {
        $form->add(new Form_checkbox('new_project', __('New project', 'form label'), false, "id='proj_new_checkbox'"));
        $form->add(new Form_Input('new_project_name', __('Project name', 'form label'), false, NULL, false, "id='proj_new_input'", "style='display:none'"));
    }
    $checked1 = "";
    $checked2 = "";
    if ($task->id == 0) {
        $checked1 = "checked";
        $checked2 = "checked";
        $person_select = -1;
    }
    ## eventually needed later when note is a subcategory of task
    /*else {
          if(!$pperson = $task->getAssignedPeople()){
              $PH->abortWarning(__("ERROR: could not get assigned people"), ERROR_NOTE);
          }
          else{
              foreach($pperson as $pp){
                  if($pp->id == $person->id){
                      $checked1= "checked";
                  }
                  elseif($pp->id == $auth->cur_user->id){
                      $checked2= "checked";
                  }
                  else{
                      $person_select = $pp->id;
                  }
              }
          }
      }*/
    $form->add(new Form_customHTML('<p><label>' . __('Assign to') . '</lable></p>', 'assigne_note'));
    if ($person->id != $auth->cur_user->id) {
        $form->add(new Form_customHTML('<span class="checker"><input value="' . $person->id . '" name="task_assignement1" type="checkbox" ' . $checked1 . '><label for="task_assignement1">' . $person->name . '</label></span>', 'assigned_person1'));
        $form->add(new Form_customHTML('<span class="checker"><input value="' . $auth->cur_user->id . '" name="task_assignement2" type="checkbox" ' . $checked2 . '><label for="task_assignement2">' . $auth->cur_user->name . '</label></span>', 'assigned_person2'));
    } else {
        $form->add(new Form_customHTML('<span class="checker"><input value="' . $auth->cur_user->id . '" name="task_assignement2" type="checkbox" ' . $checked2 . '><label for="task_assignement2">' . $auth->cur_user->name . '</label></span>', 'assigned_person'));
    }
    $pers_list = array();
    $pers_list[-1] = __('undefined');
    if ($people = Person::getPeople(array('can_login' => 1))) {
        foreach ($people as $pers) {
            if ($auth->cur_user->name != $pers->name) {
                $pers_list[$pers->id] = $pers->name;
            }
        }
    }
    $form->add(new Form_Dropdown('task_also_assign', __('Also assign to'), array_flip($pers_list), $person_select));
    ## Book effort after submit ##
    $form->form_options[] = "<span class=option><input id='book_effort' name='book_effort' class='checker' type=checkbox>" . __("Book effort after submit") . "</span>";
    $form->add(new Form_HiddenField('tsk', '', $task->id));
    $form->add(new Form_HiddenField('person_id', '', $person->id));
    $form->add(new Form_HiddenField('creation_time', '', $time));
    echo $form;
    $PH->go_submit = 'taskNoteOnPersonEditSubmit';
    echo new PageContentClose();
    echo new PageHtmlEnd();
}
コード例 #14
0
ファイル: users.php プロジェクト: korusdipl/eventum
if ($role_id < User::getRoleID('manager')) {
    Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
    $tpl->displayTemplate();
    exit;
}
if (@$_POST['cat'] == 'new') {
    $res = User::insertFromPost();
    Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the user was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new user.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
    $res = User::updateFromPost();
    Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the user was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the user information.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'change_status') {
    User::changeStatus($_POST['items'], $_POST['status']);
}
$project_roles = array();
$project_list = Project::getAll();
if (@$_GET['cat'] == 'edit') {
    $info = User::getDetails($_GET['id']);
    $tpl->assign('info', $info);
}
foreach ($project_list as $prj_id => $prj_title) {
    $excluded_roles = array('Customer');
    if (@$info['roles'][$prj_id]['pru_role'] == User::getRoleID('Customer')) {
        if (count($excluded_roles) == 1) {
            $excluded_roles = false;
        } else {
            $excluded_roles = array('administrator');
        }
        if (@$info['roles'][$prj_id]['pru_role'] == User::getRoleID('administrator')) {
            $excluded_roles = false;
        }
コード例 #15
0
ファイル: index.php プロジェクト: justmoon/codestewart
<?php

require_once 'lib/common.inc.php';
require_once 'lib/project.class.php';
cs_show_header('Code Stewart', '<link rel="stylesheet" type="text/css" href="' . cs_res_url('jqueryfinder/ui.finder.css') . '">' . "\r\n" . '<script type="text/javascript" src="' . cs_res_url('jqueryfinder/ui.finder.js') . '"></script>' . "\r\n" . '<script type="text/javascript" src="' . cs_res_url('script/CodeStewart.js') . '"></script>' . "\r\n" . '<script type="text/javascript" src="' . cs_res_url('script/page/index.js') . '"></script>' . "\r\n");
?>
<div id="projectList">
<?php 
foreach (Project::getAll() as $project) {
    ?>
	<h3><a href="#"><span class="name"><?php 
    echo $project->getTitle();
    ?>
</span> &bull; <span class="status"></span></a></h3>
	<ul id="project_<?php 
    echo $project->getName();
    ?>
" class="project"></ul>
<?php 
}
?>
</div>
<?php 
cs_show_footer();
コード例 #16
0
ファイル: news.php プロジェクト: juliogallardo1326/proc
include_once "../config.inc.php";
include_once APP_INC_PATH . "class.template.php";
include_once APP_INC_PATH . "class.auth.php";
include_once APP_INC_PATH . "class.project.php";
include_once APP_INC_PATH . "class.news.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("manage/index.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
$tpl->assign("type", "news");
$role_id = Auth::getCurrentRole();
if ($role_id == User::getRoleID('administrator') || $role_id == User::getRoleID('manager')) {
    if ($role_id == User::getRoleID('administrator')) {
        $tpl->assign("show_setup_links", true);
    }
    if (@$HTTP_POST_VARS["cat"] == "new") {
        $tpl->assign("result", News::insert());
    } elseif (@$HTTP_POST_VARS["cat"] == "update") {
        $tpl->assign("result", News::update());
    } elseif (@$HTTP_POST_VARS["cat"] == "delete") {
        News::remove();
    }
    if (@$HTTP_GET_VARS["cat"] == "edit") {
        $tpl->assign("info", News::getAdminDetails($HTTP_GET_VARS["id"]));
    }
    $tpl->assign("list", News::getList());
    $tpl->assign("project_list", Project::getAll());
} else {
    $tpl->assign("show_not_allowed_msg", true);
}
$tpl->displayTemplate();
コード例 #17
0
 public function testGetAllWhenThereAreNone()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $projects = Project::getAll();
     $this->assertEquals(1, count($projects));
 }
コード例 #18
0
 public function testCloningWithAnotherProject()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     Yii::app()->user->userModel = $super;
     $project = ProjectTestHelper::createProjectByNameForOwner("My Project 1", $super);
     $id = $project->id;
     $this->setGetArray(array('id' => $id));
     $content = $this->runControllerWithNoExceptionsAndGetContent('projects/default/copy');
     $this->assertContains('My Project 1', $content);
     $projects = Project::getAll();
     $this->assertEquals(1, count($projects));
 }
コード例 #19
0
 function test_updateDueDate()
 {
     //Arrange
     $name = "Build a shed";
     $motivation = "have storage";
     $due_date = "2015-09-09";
     $priority = 1;
     $test_project = new Project($name, $motivation, $due_date, $priority);
     $test_project->save();
     $new_due_date = "2015-10-10";
     //Act
     $test_project->updateDueDate($new_due_date);
     $result = Project::getAll();
     //Assert
     $this->assertEquals($new_due_date, $result[0]->getDueDate());
 }
コード例 #20
0
/**
* renders the list of open projects that will be display when opening the project selector
*
* The opening is done with javascript. Placing the list beside the Project Selector icon
* is done by css only. This is a little bit tricky, because the Tab-list is already an
* span which allows only further Spans to be included...
*
* The selectorlist is triggered by 
*
* read more at #3867
*/
function buildProjectSelector()
{
    global $auth;
    if (!$auth->cur_user || !$auth->cur_user->id) {
        return "";
    }
    $buffer = "";
    global $PH;
    require_once confGet('DIR_STREBER') . 'db/class_company.inc.php';
    require_once confGet('DIR_STREBER') . "db/class_project.inc.php";
    $buffer .= "<span id=projectselector class=selector>&nbsp;</span>";
    $buffer .= "<span style='display:none;' id='projectselectorlist' class=selectorlist><span class=selectorlist_content>";
    foreach (Company::getAll() as $c) {
        if ($projects = Project::getAll(array('order_by' => 'c.name', 'company' => $c->id))) {
            $buffer .= "<div class='companies'><span style='float:left;margin-right:3px;'>" . __("for", "short for client") . "</span>" . $c->getLink() . "</div>";
            $buffer .= "<div class='projects'><ul>";
            foreach ($projects as $p) {
                $buffer .= "<li>" . $PH->getLink('projView', $p->name, array('prj' => $p->id)) . "</li>";
            }
            $buffer .= "</ul></div>";
        }
    }
    /* projects without client */
    if ($projects = Project::getAll(array('order_by' => 'c.name', 'company' => 0))) {
        $buffer .= "<div class='companies'><span style='float:left;margin-right:3px;'>" . __("without client", "short for client") . "</span>&nbsp;</div>";
        $buffer .= "<div class='projects'><ul>";
        foreach ($projects as $p) {
            $buffer .= "<li>" . $PH->getLink('projView', $p->name, array('prj' => $p->id)) . "</li>";
        }
        $buffer .= "</ul></div>";
    }
    $buffer .= "</span></span>";
    return $buffer;
}
コード例 #21
0
ファイル: download_emails.php プロジェクト: korusdipl/eventum
if (!$config['fix-lock'] && (empty($config['username']) || empty($config['hostname']))) {
    if (SAPI_CLI) {
        fatal('Wrong number of parameters given. Expected parameters related to the email account:', ' 1 - username', ' 2 - hostname', ' 3 - mailbox (only required if IMAP account)', 'Example: php download_emails.php user example.com INBOX');
    } else {
        fatal('Wrong number of parameters given. Expected parameters related to email account:', 'download_emails.php?username=<i>username</i>&hostname=<i>hostname</i>&mailbox=<i>mailbox</i>');
    }
}
// get the account ID early since we need it also for unlocking.
$account_id = Email_Account::getAccountID($config['username'], $config['hostname'], $config['mailbox']);
if (!$account_id && !$config['fix-lock']) {
    fatal('Could not find a email account with the parameter provided.', 'Please verify your email account settings and try again.');
}
if ($config['fix-lock']) {
    // if there is no account id, unlock all accounts
    if (!$account_id) {
        $prj_ids = array_keys(Project::getAll());
        foreach ($prj_ids as $prj_id) {
            $ema_ids = Email_Account::getAssocList($prj_id);
            foreach ($ema_ids as $ema_id => $ema_title) {
                $lockfile = 'download_emails_' . $ema_id;
                if (Lock::release($lockfile)) {
                    msg("Removed lock file '{$lockfile}'.");
                }
            }
        }
    } else {
        $lockfile = 'download_emails_' . $account_id;
        if (Lock::release($lockfile)) {
            msg("Removed lock file '{$lockfile}'.");
        }
    }
コード例 #22
0
ファイル: search.inc.php プロジェクト: Bremaweb/streber-1
 static function getForQuery($search_query, $project = NULL)
 {
     $count_overall = 0;
     $results = array();
     global $PH;
     require_once confGet('DIR_STREBER') . "db/class_company.inc.php";
     $args = array('order_str' => NULL, 'has_id' => NULL, 'search' => $search_query);
     foreach ($companies = Company::getAll($args) as $company) {
         $rate = RATE_TYPE_COMPANY;
         $rate *= SearchResult::RateItem($company);
         $rate *= SearchResult::RateTitle($company, $search_query);
         $results[] = new SearchResult(array('name' => $company->name, 'rating' => $rate, 'type' => __('Company'), 'jump_id' => 'companyView', 'jump_params' => array('company' => $company->id, 'q' => $search_query), 'item' => $company));
     }
     require_once confGet('DIR_STREBER') . "db/class_person.inc.php";
     foreach ($people = Person::getPeople(array('search' => $search_query)) as $person) {
         $rate = RATE_TYPE_PERSON;
         $rate *= SearchResult::RateItem($person);
         $rate *= SearchResult::RateTitle($person, $search_query);
         $results[] = new SearchResult(array('name' => $person->name, 'rating' => $rate, 'type' => __('Person'), 'jump_id' => 'personView', 'jump_params' => array('person' => $person->id, 'q' => $search_query), 'item' => $person));
     }
     require_once confGet('DIR_STREBER') . "db/class_project.inc.php";
     $projects = Project::getAll(array('status_min' => 0, 'status_max' => 10, 'search' => $search_query));
     if ($projects) {
         foreach ($projects as $project) {
             $rate = RATE_TYPE_PROJECT;
             if ($project->status == STATUS_TEMPLATE) {
                 $rate *= RATE_PROJECT_IS_TEMPLATE;
             } else {
                 if ($project->status < STATUS_COMPLETED) {
                     $rate *= RATE_PROJECT_IS_OPEN;
                 } else {
                     $rate *= RATE_PROJECT_IS_CLOSED;
                 }
             }
             if ($diz = SearchResult::getExtract($project, $search_query)) {
                 $rate *= RATE_IN_DETAILS;
             }
             ### status ###
             global $g_status_names;
             $status = isset($g_status_names[$project->status]) ? $g_status_names[$project->status] : '';
             if ($project->status > STATUS_COMPLETED) {
                 $rate *= RATE_TASK_STATUS_CLOSED;
             } else {
                 if ($project->status >= STATUS_COMPLETED) {
                     $rate *= RATE_TASK_STATUS_COMPLETED;
                 }
             }
             ### for company ###
             $html_location = '';
             if ($company = Company::getVisibleById($project->company)) {
                 $html_location = __('for') . ' ' . $company->getLink();
             }
             $rate *= SearchResult::RateItem($project);
             $rate *= SearchResult::RateTitle($project, $search_query);
             $results[] = new SearchResult(array('name' => $project->name, 'rating' => $rate, 'item' => $project, 'type' => __('Project'), 'jump_id' => 'projView', 'jump_params' => array('prj' => $project->id, 'q' => $search_query), 'extract' => $diz, 'status' => $status, 'html_location' => $html_location));
         }
     }
     require_once confGet('DIR_STREBER') . "db/class_task.inc.php";
     $order_str = get('sort_' . $PH->cur_page->id . "_tasks");
     $tasks = Task::getAll(array('order_by' => $order_str, 'search' => $search_query, 'status_min' => STATUS_UPCOMING, 'status_max' => STATUS_CLOSED));
     if ($tasks) {
         foreach ($tasks as $task) {
             $rate = RATE_TYPE_TASK;
             $rate *= SearchResult::RateItem($task);
             $rate *= SearchResult::RateTitle($task, $search_query);
             if ($task->category == TCATEGORY_FOLDER) {
                 $rate *= RATE_TASK_IS_FOLDER;
             }
             if ($diz = SearchResult::getExtract($task, $search_query)) {
                 $rate *= RATE_IN_DETAILS;
             }
             global $g_status_names;
             $status = isset($g_status_names[$task->status]) ? $g_status_names[$task->status] : '';
             if ($task->status > STATUS_COMPLETED) {
                 $rate *= RATE_TASK_STATUS_CLOSED;
             } else {
                 if ($task->status >= STATUS_COMPLETED) {
                     $rate *= RATE_TASK_STATUS_COMPLETED;
                 }
             }
             if ($project = Project::getVisibleById($task->project)) {
                 $prj = $project->getLink();
             } else {
                 $prj = '';
             }
             $html_location = __('in') . " <b>{$prj}</b> &gt; " . $task->getFolderLinks();
             $is_done = $task->status < STATUS_COMPLETED ? false : true;
             $results[] = new SearchResult(array('name' => $task->name, 'rating' => $rate, 'extract' => $diz, 'item' => $task, 'type' => $task->getLabel(), 'status' => $status, 'html_location' => $html_location, 'is_done' => $is_done, 'jump_id' => 'taskView', 'jump_params' => array('tsk' => $task->id, 'q' => $search_query)));
         }
     }
     require_once confGet('DIR_STREBER') . "db/class_comment.inc.php";
     $comments = Comment::getAll(array('search' => $search_query));
     if ($comments) {
         foreach ($comments as $comment) {
             $rate = RATE_TYPE_COMMENT;
             $rate *= SearchResult::RateItem($comment);
             $rate *= SearchResult::RateTitle($comment, $search_query);
             if ($diz = SearchResult::getExtract($comment, $search_query)) {
                 $rate *= RATE_IN_DETAILS;
             }
             if ($project = Project::getVisibleById($comment->project)) {
                 $prj = $project->getLink();
             } else {
                 $prj = '';
             }
             $html_location = __('on') . " <b>{$prj}</b>";
             $is_done = false;
             if ($task = Task::getVisibleById($comment->task)) {
                 if ($folders = $task->getFolderLinks()) {
                     $html_location .= ' &gt; ' . $folders;
                 }
                 $html_location .= ' &gt; ' . $task->getLink(false);
                 if ($task->status >= STATUS_COMPLETED) {
                     $is_done = true;
                 }
             } else {
                 $html_location = '';
             }
             $results[] = new SearchResult(array('name' => $comment->name, 'rating' => $rate, 'extract' => $diz, 'type' => __('Comment'), 'html_location' => $html_location, 'jump_id' => 'commentView', 'jump_params' => array('comment' => $comment->id, 'q' => $search_query), 'item' => $comment, 'is_done' => $is_done));
         }
     }
     $count_overall += count($comments);
     require_once confGet('DIR_STREBER') . "db/class_effort.inc.php";
     $efforts = Effort::getAll(array('search' => $search_query));
     if ($efforts) {
         foreach ($efforts as $effort) {
             $rate = RATE_TYPE_EFFORT;
             $rate *= SearchResult::RateItem($effort);
             $rate *= SearchResult::RateTitle($effort, $search_query);
             if ($diz = SearchResult::getExtract($effort, $search_query)) {
                 $rate *= RATE_IN_DETAILS;
             }
             if ($project = Project::getVisibleById($effort->project)) {
                 $prj = $project->getLink();
             } else {
                 $prj = '';
             }
             $html_location = __('on') . " <b>{$prj}</b>";
             $is_done = false;
             if ($task = Task::getVisibleById($effort->task)) {
                 if ($folders = $task->getFolderLinks()) {
                     $html_location .= ' &gt; ' . $folders;
                 }
                 $html_location .= ' &gt; ' . $task->getLink(false);
                 if ($task->status >= STATUS_COMPLETED) {
                     $is_done = true;
                 }
             } else {
                 $html_location = '';
             }
             $results[] = new SearchResult(array('name' => $effort->name, 'rating' => $rate, 'extract' => $diz, 'type' => __('Effort'), 'html_location' => $html_location, 'jump_id' => 'effortView', 'jump_params' => array('effort' => $effort->id, 'q' => $search_query), 'item' => $effort, 'is_done' => $is_done));
         }
     }
     $count_overall += count($efforts);
     return $results;
 }
コード例 #23
0
ファイル: project.php プロジェクト: r-hills/live_test
//     if (!empty($new_name = $_POST['name'])) {
//         $project->updateName(preg_quote($new_name));
//     }
//     if(!empty($new_motivation = $_POST['motivation'])) {
//         $project->updateMotivation(preg_quote($new_motivation));
//     }
//     if(!empty($new_due_date = $_POST['due_date'])) {
//         $project->updateDueDate(preg_quote($new_due_date));
//     }
//     if(!empty($new_priority = $_POST['priority'])) {
//         $project->updatePriority(preg_quote($new_priority));
//     }
//     return $app['twig']->render('project/project.html.twig',
//         array('project' => $project, 'steps' => $project->getSteps())
//     );
// });
// Delete a single Project and display current Projects list page
$project->delete('/project/{id}', function ($id) use($app) {
    $project = Project::find($id);
    $project->delete();
    return $app['twig']->render('project/current_projects.html.twig', array('projects' => Project::getAll()));
});
// Add Step
$project->post('/project/{id}', function ($id) use($app) {
    $project = Project::find($id);
    $step_input = formatFormInput($_POST);
    $new_step = new Step($step_input['description'], $id, $step_input['position']);
    return $app['twig']->render('project/project.html.twig', array('project' => $project, 'steps' => $project->getSteps()));
});
// Place all urls in this file at /project/*
$app->mount('/project', $project);
コード例 #24
0
/*
 * This file is part of the Eventum (Issue Tracking System) package.
 *
 * @copyright (c) Eventum Team
 * @license GNU General Public License, version 2 or later (GPL-2+)
 *
 * For the full copyright and license information,
 * please see the COPYING and AUTHORS files
 * that were distributed with this source code.
 */
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/email_accounts.tpl.html');
Auth::checkAuthentication();
$tpl->assign('all_projects', Project::getAll());
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_REPORTER) {
    Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
    $tpl->displayTemplate();
    exit;
}
if (@$_POST['cat'] == 'new') {
    Misc::mapMessages(Email_Account::insert(), array(1 => array(ev_gettext('Thank you, the email account was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new account.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
    Misc::mapMessages(Email_Account::update(), array(1 => array(ev_gettext('Thank you, the email account was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the account information.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
    Misc::mapMessages(Email_Account::remove(), array(1 => array(ev_gettext('Thank you, the email account was deleted successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to delete the account information.'), Misc::MSG_ERROR)));
}
if (@$_GET['cat'] == 'edit') {
    $tpl->assign('info', Email_Account::getDetails($_GET['id']));
コード例 #25
0
 function test_delete()
 {
     //Arrange
     $name = "Build a shed";
     $motivation = "have storage";
     $due_date = "2015-09-09";
     $priority = 1;
     $test_project = new Project($name, $motivation, $due_date, $priority);
     $test_project->save();
     $name2 = "Learn French";
     $motivation2 = "To travel";
     $test_project2 = new Project($name2, $motivation2, $due_date, $priority);
     $test_project2->save();
     //Act
     $test_project->delete();
     $result = Project::getAll();
     //Assert
     $this->assertEquals([$test_project2], $result);
 }
コード例 #26
0
// +----------------------------------------------------------------------+
//
// @(#) $Id: s.email_accounts.php 1.5 03/01/16 01:47:32-00:00 jpm $
//
include_once "../config.inc.php";
include_once APP_INC_PATH . "class.template.php";
include_once APP_INC_PATH . "class.auth.php";
include_once APP_INC_PATH . "class.user.php";
include_once APP_INC_PATH . "class.project.php";
include_once APP_INC_PATH . "class.support.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("manage/index.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
$tpl->assign("type", "email_accounts");
$tpl->assign("all_projects", Project::getAll());
$role_id = Auth::getCurrentRole();
if ($role_id == User::getRoleID('administrator')) {
    $tpl->assign("show_setup_links", true);
    if (@$HTTP_POST_VARS["cat"] == "new") {
        $tpl->assign("result", Email_Account::insert());
    } elseif (@$HTTP_POST_VARS["cat"] == "update") {
        $tpl->assign("result", Email_Account::update());
    } elseif (@$HTTP_POST_VARS["cat"] == "delete") {
        Email_Account::remove();
    }
    if (@$HTTP_GET_VARS["cat"] == "edit") {
        $tpl->assign("info", Email_Account::getDetails($HTTP_GET_VARS["id"]));
    }
    $tpl->assign("list", Email_Account::getList());
} else {
コード例 #27
0
 /**
  *Test Bug with mass delete and multiple pages when using select all
  */
 public function testRegularMassDeletePagesProperlyAndRemovesAllSelected()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $confused = User::getByUsername('confused');
     $nobody = User::getByUsername('nobody');
     //Load MassDelete view for the 6 projects
     $projects = Project::getAll();
     $this->assertEquals(9, count($projects));
     //mass Delete pagination scenario
     //Run Mass Delete using progress save for page1
     $this->setGetArray(array('selectAll' => '1', 'Project_page' => 1));
     $this->setPostArray(array('selectedRecordCount' => 9));
     $pageSize = Yii::app()->pagination->getForCurrentUserByType('massDeleteProgressPageSize');
     $this->assertEquals(5, $pageSize);
     $content = $this->runControllerWithExitExceptionAndGetContent('projects/default/massDelete');
     $projects = Project::getAll();
     $this->assertEquals(4, count($projects));
     //Run Mass Delete using progress save for page2
     $this->setGetArray(array('selectAll' => '1', 'Project_page' => 2));
     $this->setPostArray(array('selectedRecordCount' => 9));
     $pageSize = Yii::app()->pagination->getForCurrentUserByType('massDeleteProgressPageSize');
     $this->assertEquals(5, $pageSize);
     $content = $this->runControllerWithNoExceptionsAndGetContent('projects/default/massDeleteProgress');
     $projects = Project::getAll();
     $this->assertEquals(0, count($projects));
 }
コード例 #28
0
function ajaxUserProjects()
{
    global $PH;
    global $auth;
    require_once confGet('DIR_STREBER') . 'db/class_company.inc.php';
    $projects = array();
    if ($q = getOnePassedId("q")) {
        $all_projects = Project::getAll();
        foreach ($all_projects as $p) {
            if (stristr($p->name, $q) !== false) {
                $projects[] = $p;
            }
        }
    } else {
        $projects = Project::getAll();
    }
    $result = array();
    foreach ($projects as $p) {
        $company_name = "";
        if ($company = Company::getVisibleById($p->company)) {
            $company_name = $company->getShort(12);
        }
        $result[] = array('name' => $p->name . " – " . $company_name, 'id' => $p->id);
    }
    echo json_encode($result);
}
コード例 #29
0
ファイル: monitor.php プロジェクト: dabielkabuto/eventum
<?php

/*
 * This file is part of the Eventum (Issue Tracking System) package.
 *
 * @copyright (c) Eventum Team
 * @license GNU General Public License, version 2 or later (GPL-2+)
 *
 * For the full copyright and license information,
 * please see the COPYING and AUTHORS files
 * that were distributed with this source code.
 */
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/monitor.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_REPORTER) {
    Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
    $tpl->displayTemplate();
    exit;
}
$tpl->assign('project_list', Project::getAll());
if (!empty($_POST['cat']) && $_POST['cat'] == 'update') {
    $setup = array('diskcheck' => $_POST['diskcheck'], 'paths' => $_POST['paths'], 'ircbot' => $_POST['ircbot']);
    $res = Setup::save(array('monitor' => $setup));
    Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the setup information was saved successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext("ERROR: The system doesn't have the appropriate permissions to create the configuration file in the setup directory (%s). " . 'Please contact your local system administrator and ask for write privileges on the provided path.', APP_CONFIG_PATH), Misc::MSG_NOTE_BOX), -2 => array(ev_gettext("ERROR: The system doesn't have the appropriate permissions to update the configuration file in the setup directory (%s). " . 'Please contact your local system administrator and ask for write privileges on the provided filename.', APP_SETUP_FILE), Misc::MSG_NOTE_BOX)));
}
$tpl->assign(array('enable_disable', array('enabled' => ev_gettext('Enabled'), 'disabled' => ev_gettext('Disabled')), 'setup' => Setup::get()));
$tpl->displayTemplate();
コード例 #30
0
 /**
  * print a complete list as html
  * - use filters
  * - use check list style (tree, list, grouped)
  * - check customization-values
  * - check sorting
  * - get objects from database
  *
  */
 public function print_automatic()
 {
     global $PH;
     if (!($this->active_block_function = $this->getBlockStyleFromCookie())) {
         $this->active_block_function = 'list';
     }
     $this->group_by = get("blockstyle_{$PH->cur_page->id}_{$this->id}_grouping");
     $this->initOrderQueryOption();
     ### add filter options ###
     foreach ($this->filters as $f) {
         foreach ($f->getQuerryAttributes() as $k => $v) {
             $this->query_options[$k] = $v;
         }
     }
     ### grouped view ###
     if ($this->active_block_function == 'grouped') {
         /**
          * @@@ later use only once...
          *
          *   $this->columns= filterOptions($this->columns,"CURPAGE.BLOCKS[{$this->id}].STYLE[{$this->active_block_function}].COLUMNS");
          */
         if (isset($this->columns[$this->group_by])) {
             unset($this->columns[$this->group_by]);
         }
         ### prepend key to sorting ###
         if (isset($this->query_options['order_by'])) {
             $this->query_options['order_by'] = $this->groupings->getActiveFromCookie() . "," . $this->query_options['order_by'];
         } else {
             $this->query_options['order_by'] = $this->groupings->getActiveFromCookie();
         }
     } else {
         $pass = true;
     }
     $projects = Project::getAll($this->query_options);
     $this->render_list($projects);
 }