本文整理汇总了PHP中Project::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::load方法的具体用法?PHP Project::load怎么用?PHP Project::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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);
}
示例2: _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);
}
示例3: getProject
public static function getProject($id = null)
{
if ($id != null) {
$project = Project::load($id);
// possible user loading method
} else {
$project = Project::loadAll();
}
return $project;
}
示例4: tasksindex
public function tasksindex()
{
$this->view->set('clickaction', 'viewtask');
if (!empty($this->_data['project_id'])) {
$project = new Project();
$project->load($this->_data['project_id']);
$tasks = $project->tasks;
$this->view->set('no_ordering', true);
} else {
$tasks = new TaskCollection($this->_templateobject);
}
parent::index($tasks);
}
示例5: Project
<?php
# new_task.php
# 1. logic
$project = new Project();
$project->load(['slug' => Route::param('slug')]);
if (Input::posted()) {
$task = new Task();
$task->fill(Input::all());
$task->user_id = Auth::user_id();
$task->project_id = $project->id;
if (Input::get('name') != "" || Input::get('description') != "") {
$task->save();
}
}
URL::redirect('/' . $project->slug);
示例6: getStartEndDate
public function getStartEndDate($_project_id = '', $_task_id = '')
{
if (!empty($this->_data['project_id'])) {
$_project_id = $this->_data['project_id'];
}
if (!empty($this->_data['task_id'])) {
$_task_id = $this->_data['task_id'];
}
$obj = '';
if (!empty($_task_id)) {
$obj = new Task();
$obj->load($_task_id);
} elseif (!empty($_project_id)) {
$obj = new Project();
$obj->load($_project_id);
}
if ($obj instanceof DataObject && $obj->isLoaded()) {
$start_date = un_fix_date($obj->start_date, true);
$end_date = un_fix_date($obj->end_date, true);
} else {
$start_date = $end_date = date(DATE_FORMAT) . ' 00:00';
}
$dates = array('start_date' => $start_date, 'end_date' => $end_date);
$start_date_hours = array_shift(explode(':', array_pop(explode(' ', $start_date))));
$start_date_minutes = array_pop(explode(':', array_pop(explode(' ', $start_date))));
$start_date = array_shift(explode(' ', $start_date));
$end_date_hours = array_shift(explode(':', array_pop(explode(' ', $end_date))));
$end_date_minutes = array_pop(explode(':', array_pop(explode(' ', $end_date))));
$end_date = array_shift(explode(' ', $end_date));
$output['start_date'] = array('data' => $start_date, 'is_array' => is_array($start_date));
$output['start_date_hours'] = array('data' => $start_date_hours, 'is_array' => is_array($start_date_hours));
$output['start_date_minutes'] = array('data' => $start_date_minutes, 'is_array' => is_array($start_date_minutes));
$output['end_date'] = array('data' => $end_date, 'is_array' => is_array($end_date));
$output['end_date_hours'] = array('data' => $end_date_hours, 'is_array' => is_array($end_date_hours));
$output['end_date_minutes'] = array('data' => $end_date_minutes, 'is_array' => is_array($end_date_minutes));
if (isset($this->_data['ajax'])) {
$this->view->set('data', $output);
$this->setTemplateName('ajax_multiple');
} else {
return $dates;
}
}
示例7: isset
<?php
require_once "../../global.php";
require_once TEMPLATE_PATH . '/site/helper/format.php';
$projectId = isset($_POST['projectID']) ? Filter::numeric($_POST['projectID']) : $_POST['selProject'];
//Validate that the project id specified corresponds to an actual project.
// kick us out if slug or task invalid
$project = Project::load($projectId);
//Find referral url in case there is a problem and we have to redirect the user
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : Url::dashboard();
if ($project == null) {
Session::setMessage('You must select a project to upload tasks from a CSV');
header('Location: ' . $referer);
exit;
} else {
//Check if project creator or admin
if (Session::isAdmin() || $project->isCreator(Session::getUserID())) {
//Want to make sure end of file is .csv and not .xcsv (for example)
//Need to figure out how to add CSV file filtering
//Run each line of csv through validator and return JSON string
$targetDir = UPLOAD_PATH;
// 5 minutes execution time
@set_time_limit(5 * 60);
// Get parameters
$chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
//Make sure the user uploaded a file
if (empty($fileName)) {
Session::setMessage('You must select a CSV file');
header('Location: ' . $referer);
示例8: project_editor
/**
* Output the Project Editor interface.
*
* @since 1.2.0 Added comments/reference display/editing,
* Added Original link on PME edited versions.
* @since 1.1.0 Updated add buttons to be advanced-mode-only,
* improved printf calls for localization purposes.
* @since 1.0.0
*
* @global string $plugin_page The slug of the current admin page.
*/
protected static function project_editor()
{
global $plugin_page;
$file = $_REQUEST['pofile'];
// Load
$path = realpath(WP_CONTENT_DIR . '/' . $file);
$project = new Project($path);
$project->load();
// Figure out the text direction for the translated text
$direction = in_array(substr($project->language(true), 0, 2), Dictionary::$rtl_languages) ? 'rtl' : 'ltr';
?>
<form method="post" action="tools.php?page=<?php
echo $plugin_page;
?>
" id="pomoeditor">
<input type="hidden" name="pofile" value="<?php
echo $file;
?>
" />
<?php
wp_nonce_field('pomoeditor-manage-' . md5($file), '_pomoeditor_nonce');
?>
<h2><?php
/* Translators: %1$s = filename */
printf(__('Editing: <code>%s</code>', 'pomo-editor'), $file);
?>
</h2>
<?php
if ($project->is_modded()) {
$original = $project->file();
?>
<p><?php
/* Translators: %1$s = filename, %2$s = URL */
printf(__('Original: <a href="%2$s" target="_blank">%1$s</a>', 'pomo-editor'), $original, admin_url("tools.php?page=pomo-editor&pofile={$original}&changes-saved=true"));
?>
</p>
<?php
}
?>
<p>
<?php
/* Translators: %1$s = package name, %2$s = package type (system, theme, plugin) */
printf(__('<strong>Package:</strong> %1$s (%2$s)', 'pomo-editor'), $project->package('name'), $project->package('type'));
?>
<br />
<?php
/* Translators: %1$s = language name */
printf(__('<strong>Language:</strong> %1$s', 'pomo-editor'), $project->language());
?>
</p>
<p>
<button type="button" id="pomoeditor_advanced" class="button button-secondary"><?php
_e('Enable Advanced Editing', 'pomo-editor');
?>
</button>
</p>
<h3><?php
_e('Translations', 'pomo-editor');
?>
</h3>
<table id="pomoeditor_translations" class="fixed striped widefat pme-direction-<?php
echo $direction;
?>
">
<thead>
<tr>
<th class="pme-edit-col">
<button type="button" title="<?php
_e('Add Translation Entry', 'pomo-editor');
?>
" class="pme-button pme-add pomoeditor-advanced"><?php
_e('Add Entry', 'pomo-editor');
?>
</button>
</th>
<th class="pme-source"><?php
_e('Source Text', 'pomo-editor');
?>
</th>
<th class="pme-translation"><?php
_e('Translated Text', 'pomo-editor');
?>
</th>
//.........这里部分代码省略.........
示例9: getStartEndDate
public function getStartEndDate($_project_id = '', $_task_id = '')
{
if (!empty($this->_data['project_id'])) {
$_project_id = $this->_data['project_id'];
}
if (!empty($this->_data['task_id'])) {
$_task_id = $this->_data['task_id'];
}
$obj = '';
if (!empty($_task_id)) {
$obj = new Task();
$obj->load($_task_id);
} elseif (!empty($_project_id)) {
$obj = new Project();
$obj->load($_project_id);
}
if ($obj instanceof DataObject && $obj->isLoaded()) {
$start_date = un_fix_date($obj->start_date);
$end_date = un_fix_date($obj->end_date);
} else {
$start_date = $end_date = date(DATE_FORMAT);
}
$output['start_date'] = array('data' => $start_date, 'is_array' => is_array($start_date));
$output['end_date'] = array('data' => $end_date, 'is_array' => is_array($end_date));
if (isset($this->_data['ajax'])) {
$this->view->set('data', $output);
$this->setTemplateName('ajax_multiple');
} else {
return $output;
}
}
示例10: foreach
});
});
});
</script>
<ul class="segmented-list invitations">
<?php
if (empty($unrespondedInvites)) {
echo '<li class="none">(none)</li>';
}
foreach ($invitations as $i) {
// project title
$project = Project::load($i->getProjectID());
$projectTitle = $project->getTitle();
if ($i->getResponse() != null) {
echo '<li id="invitation-' . $i->getID() . '" class="responded hidden">';
} else {
echo '<li id="invitation-' . $i->getID() . '">';
}
if ($i->getTrusted()) {
echo '<p class="project">' . formatUserLink($i->getInviterID(), $project->getID()) . ' invited you to join the project ' . formatProjectLink($i->getProjectID()) . ' as a <a href="' . Url::help() . '">trusted member</a>. (' . formatTimeTag($i->getDateCreated()) . ')</p>';
} else {
echo '<p class="project">' . formatUserLink($i->getInviterID(), $project->getID()) . ' invited you to join the project ' . formatProjectLink($i->getProjectID()) . '. (' . formatTimeTag($i->getDateCreated()) . ')</p>';
}
// show the invitation message, if it exists
if ($i->getInvitationMessage() != null) {
echo '<blockquote>' . formatInvitationMessage($i->getInvitationMessage()) . '</blockquote>';
}
示例11: formatProjectLink
function formatProjectLink($projectID = null)
{
if ($projectID == null) {
return null;
}
$project = Project::load($projectID);
$formatted = '<a href="' . Url::project($projectID) . '">' . $project->getTitle() . '</a>';
return $formatted;
}
示例12: getProjectName
public function getProjectName()
{
if (!$this->_resourceUrl) {
throw new \Exception("Can't getProjectName() because resourceUrl not set on this HistoryItem object");
}
$this->load($this->_resourceUrl);
if (!$this->_data['project']) {
return "(No Project Associated)";
}
$project = new Project();
$project->load($this->_data['project']);
return $project->getName();
}
示例13: project
public static function project($projectID = null)
{
if ($projectID == null) {
return null;
}
$project = Project::load($projectID);
$slug = $project->getSlug();
return self::base() . '/projects/' . $slug;
}
示例14: getProjectFromSlug
public static function getProjectFromSlug($slug = null)
{
if ($slug == null) {
return null;
}
$query = "SELECT id FROM " . self::DB_TABLE;
$query .= " WHERE slug = '" . $slug . "'";
$db = Db::instance();
$result = $db->lookup($query);
if (!mysql_num_rows($result)) {
return null;
}
$row = mysql_fetch_assoc($result);
$project = Project::load($row['id']);
return $project;
}
示例15: foreach
echo ' <th style="padding-left: 22px;">Task</th>';
echo ' <th>Status</th>';
echo ' <th>Deadline</th>';
echo ' <th>Needed</th>';
if (!is_null($user)) {
echo ' <th>Role</th>';
}
echo '</tr>';
foreach ($tasks as $t) {
echo '<tr>';
// title
echo '<td class="name">';
echo '<h6><a href="' . Url::task($t->getID()) . '">' . $t->getTitle() . '</a></h6>';
if (is_null($project)) {
// project
$ptitle = Project::load($t->getProjectID())->getTitle();
echo '<p>in <a href="' . Url::project($t->getProjectID()) . '">' . $ptitle . '</a></p>';
} else {
// description
echo '<p>';
$description = strip_tags(formatTaskDescription($t->getDescription()));
echo substr($description, 0, 70);
if (strlen($description) > 70) {
echo '…';
}
echo '</p>';
}
echo '</td>';
// status
if ($t->getStatus() == Task::STATUS_OPEN) {
echo '<td class="status good">open</td>';