本文整理汇总了PHP中Project类的典型用法代码示例。如果您正苦于以下问题:PHP Project类的具体用法?PHP Project怎么用?PHP Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Project类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: resources_handle_on_project_user_removed
/**
* 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
}
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:33,代码来源:on_project_user_removed.php
示例2: display
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();
}
开发者ID:aldridged,项目名称:airtap-sugar,代码行数:27,代码来源:view.edit.php
示例3: getProjects
/**
* 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');
}
}
开发者ID:riehlemt,项目名称:neontsunami,代码行数:13,代码来源:SitemapsController.php
示例4: addUserAsProjectAdmin
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);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:UserPermissionsDao.class.php
示例5: getDashboardItemData
public function getDashboardItemData()
{
$data = array();
$project = new Project();
$data['numberOfProjects'] = $project->Count("status = 'Active'");
return $data;
}
开发者ID:riazuddinahmed1,项目名称:icehrm,代码行数:7,代码来源:ProjectsAdminManager.php
示例6: build
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("[31mBuild failed[0m\n\n[33mOutput[0m\n%s\n\n[33m Error[0m%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);
}
}
}
开发者ID:richsage,项目名称:Sismo,代码行数:29,代码来源:Sismo.php
示例7: __construct
public function __construct(Project $project, $count, $selected)
{
$this->label = util_unconvert_htmlspecialchars($project->getPublicName());
$this->count = $count;
$this->value = $project->getGroupId();
$this->selected = $selected;
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:SearchResultProjectsFacet.class.php
示例8: project
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;
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:27,代码来源:project.php
示例9: buildRequest
/**
* @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);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:10,代码来源:XMLFullStructureExporter.php
示例10: store
/**
* 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!';
}
}
}
开发者ID:Nabil5352,项目名称:Team-Management-Application,代码行数:34,代码来源:ProjectController.php
示例11: iterateSubProjects
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 .= ' ';
}
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;
}
开发者ID:nyeholt,项目名称:relapse,代码行数:26,代码来源:ProjectSelector.php
示例12: getMatchingArtifacts
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);
}
开发者ID:rinodung,项目名称:tuleap,代码行数:7,代码来源:Search.class.php
示例13: getProject
public function getProject()
{
$buglist = $this->getBuglist();
$project = new Project();
$project->getByID($buglist->pr_id);
return $project;
}
开发者ID:Nikolas1995,项目名称:curv-e,代码行数:7,代码来源:Bug.class.php
示例14: getOpenTimeslotTasks
/**
* 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;
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:39,代码来源:ProjectTasks.class.php
示例15: _new
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);
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:31,代码来源:LoggedcallsController.php
示例16: display
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();
}
开发者ID:omusico,项目名称:suitecrm-docker,代码行数:27,代码来源:view.edit.php
示例17: _new
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);
}
开发者ID:uzerpllp,项目名称:uzerp,代码行数:25,代码来源:ProjectnotesController.php
示例18: testManageClientTest
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;
}
开发者ID:kitware,项目名称:cdash,代码行数:33,代码来源:test_customclientscript.php
示例19: testCRUD
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);
}
开发者ID:rknox,项目名称:PPM-App,代码行数:29,代码来源:CRUDTest.php
示例20: testIfSessionCanAddEntity
public function testIfSessionCanAddEntity()
{
$project = new Project();
$project->setName('My Project');
$this->session->addEntity($project);
$this->assertTrue($this->session->isAdded($project));
}
开发者ID:andho,项目名称:simdal,代码行数:7,代码来源:SimDAL_SessionTest.php
注:本文中的Project类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论