本文整理汇总了PHP中Project::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::getAll方法的具体用法?PHP Project::getAll怎么用?PHP Project::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::getAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _new
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: home
/**
* 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();
}
示例3: setUp
public function setUp()
{
parent::setUp();
$this->super = User::getByUsername('super');
Yii::app()->user->userModel = $this->super;
$projects = Project::getAll();
$this->project = $projects[0];
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:8,代码来源:DashboardActiveProjectListViewColumnAdapterTest.php
示例4: index
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: find
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: show
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: testSimpleUserImportWhereAllRowsSucceed
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: _new
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: personEdit
//.........这里部分代码省略.........
$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);
示例10: array
<?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: test_getIncompleteStep
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: getProjectsAllWrapper
function getProjectsAllWrapper()
{
$data = Project::getAll(App::getClient());
print json_encode($data);
}
示例13: taskNoteOnPersonEdit
/**
* 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'"));
//.........这里部分代码省略.........
示例14: array
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: cs_show_header
<?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> • <span class="status"></span></a></h3>
<ul id="project_<?php
echo $project->getName();
?>
" class="project"></ul>
<?php
}
?>
</div>
<?php
cs_show_footer();