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); }
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); }
public static function getProject($id = null) { if ($id != null) { $project = Project::load($id); // possible user loading method } else { $project = Project::loadAll(); } return $project; }
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); }
<?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);
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; } }
<?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);
/** * 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> <th class="pme-context"><?php _e('Context', 'pomo-editor'); ?> </th> </tr> </thead> <tfoot></tfoot> <tbody></tbody> </table> <div class="pomoeditor-advanced"> <h3><?php _e('Headers', 'pomo-editor'); ?> </h3> <table id="pomoeditor_headers" class="fixed striped widefat"> <thead> <tr> <th class="pme-edit-col"> <button type="button" title="<?php _e('Add Translation Entry', 'pomo-editor'); ?> " class="pme-button pme-add"><?php _e('Add Translation Entry', 'pomo-editor'); ?> </button> </th> <th class="pme-header-name"><?php _ex('Name', 'header name', 'pomo-editor'); ?> </th> <th class="pme-header-value"><?php _ex('Value', 'header value', 'pomo-editor'); ?> </th> </tr> </thead> <tfoot></tfoot> <tbody></tbody> </table> <h3><?php _e('Metadata', 'pomo-editor'); ?> </h3> <table id="pomoeditor_metadata" class="fixed striped widefat"> <thead> <tr> <th class="pme-edit-col"> </th> <th class="pme-header-name"><?php _ex('Name', 'header name', 'pomo-editor'); ?> </th> <th class="pme-header-value"><?php _ex('Value', 'header value', 'pomo-editor'); ?> </th> </tr> </thead> <tfoot></tfoot> <tbody></tbody> </table> </div> <p class="submit"> <button type="submit" id="submit" class="button button-primary"><?php _e('Save Translations', 'pomo-editor'); ?> </button> </p> <script type="text/template" id="pomoeditor_record_template"> <th class="pme-edit-col"> <button type="button" title="Delete Record" class="pme-button pme-delete"><?php _e('Delete', 'pomo-editor'); ?> </button> </th> <td class="pme-record-name"> <input type="text" class="pme-input pme-name-input" value="<%- name %>" /> </td> <td class="pme-record-value"> <input type="text" class="pme-input pme-value-input" value="<%- value %>" /> </td> </script> <script type="text/template" id="pomoeditor_translation_template"> <td class="pme-edit-col"> <button type="button" title="Edit Entry" class="pme-button pme-edit"><?php _e('Edit', 'pomo-editor'); ?> </button> <div class="pme-actions"> <button type="button" title="Cancel (discard changes)" class="pme-button pme-cancel"><?php _e('Cancel', 'pomo-editor'); ?> </button> <button type="button" title="Save Changes" class="pme-button pme-save"><?php _e('Save', 'pomo-editor'); ?> </button> <button type="button" title="Delete Entry" class="pme-button pme-delete"><?php _e('Delete', 'pomo-editor'); ?> </button> </div> </td> <td class="pme-source"> <div class="pme-previews"> <div class="pme-preview pme-singular" title="<?php _e('Singular', 'pomo-editor'); ?> "></div> <div class="pme-preview pme-plural" title="<?php _e('Plural', 'pomo-editor'); ?> "></div> </div> <div class="pme-inputs"> <textarea class="pme-input pme-singular" title="<?php _e('Singular', 'pomo-editor'); ?> " rows="4" readonly></textarea> <textarea class="pme-input pme-plural" title="<?php _e('Plural', 'pomo-editor'); ?> " rows="4" readonly></textarea> </div> <div class="pme-comments pme-extracted-comments"> <div class="pme-preview pomoeditor-basic"></div> <textarea class="pme-input pomoeditor-advanced" title="<?php _e('Developer Comments', 'pomo-editor'); ?> " rows="4" readonly></textarea> </div> </td> <td class="pme-translated"> <div class="pme-previews"> <div class="pme-preview pme-singular" title="<?php _e('Singular', 'pomo-editor'); ?> "></div> <div class="pme-preview pme-plural" title="<?php _e('Plural', 'pomo-editor'); ?> "></div> </div> <div class="pme-inputs"> <textarea class="pme-input pme-singular" title="<?php _e('Singular', 'pomo-editor'); ?> " rows="4"></textarea> <textarea class="pme-input pme-plural" title="<?php _e('Plural', 'pomo-editor'); ?> " rows="4"></textarea> </div> <div class="pme-comments pme-translator-comments"> <textarea class="pme-input" title="<?php _e('Translator Comments', 'pomo-editor'); ?> " rows="4"></textarea> </div> </td> <td class="pme-context"> <div class="pme-previews"> <div class="pme-preview"></div> </div> <div class="pme-inputs"> <textarea class="pme-input" rows="4" readonly></textarea> </div> <div class="pme-comments pme-references"> <ul class="pme-preview pomoeditor-basic"></ul> <textarea class="pme-input pomoeditor-advanced" title="<?php _e('Code References', 'pomo-editor'); ?> " rows="4" readonly></textarea> </div> </td> </script> <script> POMOEditor.Project = new POMOEditor.Framework.Project(<?php echo json_encode($project->dump()); ?> ); POMOEditor.HeadersEditor = new POMOEditor.Framework.RecordsEditor( { el: document.getElementById( 'pomoeditor_headers' ), collection: POMOEditor.Project.Headers, rowTemplate: document.getElementById( 'pomoeditor_record_template' ), } ); POMOEditor.MetadataEditor = new POMOEditor.Framework.RecordsEditor( { el: document.getElementById( 'pomoeditor_metadata' ), collection: POMOEditor.Project.Metadata, rowTemplate: document.getElementById( 'pomoeditor_record_template' ), } ); POMOEditor.TranslationsEditor = new POMOEditor.Framework.TranslationsEditor( { el: document.getElementById( 'pomoeditor_translations' ), collection: POMOEditor.Project.Translations, rowTemplate: document.getElementById( 'pomoeditor_translation_template' ), } ); </script> </form> <?php }
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; } }
}); }); }); </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>'; }
function formatProjectLink($projectID = null) { if ($projectID == null) { return null; } $project = Project::load($projectID); $formatted = '<a href="' . Url::project($projectID) . '">' . $project->getTitle() . '</a>'; return $formatted; }
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(); }
public static function project($projectID = null) { if ($projectID == null) { return null; } $project = Project::load($projectID); $slug = $project->getSlug(); return self::base() . '/projects/' . $slug; }
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; }
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>';
public static function getPossibleContributorUsernames($projectID = null) { if ($projectID === null) { return null; } $project = Project::load($projectID); $creatorID = $project->getCreatorID(); $query = "SELECT username FROM " . User::DB_TABLE; // not banned $query .= " WHERE id NOT IN ("; $query .= " SELECT user_id FROM " . ProjectUser::DB_TABLE; $query .= " WHERE project_id = " . $projectID; $query .= " AND relationship = " . ProjectUser::BANNED; $query .= " )"; // not already a contributor $query .= " AND id NOT IN ("; $query .= " SELECT creator_id FROM " . Accepted::DB_TABLE; $query .= " WHERE project_id = " . $projectID; $query .= " AND status != " . Accepted::STATUS_RELEASED; $query .= " )"; $query .= " ORDER BY username ASC"; $db = Db::instance(); $result = $db->lookup($query); if (!mysql_num_rows($result)) { return array(); } $usernames = array(); while ($row = mysql_fetch_assoc($result)) { $usernames[] = $row['username']; } return $usernames; }
public function link_sales_invoices() { // Search $errors = array(); $s_data = array(); // Set context from calling module if (isset($this->_data['project_id'])) { $s_data['project_id'] = $this->_data['project_id']; } if (isset($this->_data['Search']['project_id'])) { $this->_data['project_id'] = $this->_data['Search']['project_id']; } $project = new Project(); $project->load($this->_data['project_id']); $customer = new SLCustomer(); $customer->loadBy('company_id', $project->company_id); $s_data['slmaster_id'] = $customer->id; $this->setSearch('ProjectcostchargeSearch', 'salesInvoices', $s_data); // End of search $unassigned_list = new SInvoiceLineCollection(new SInvoiceLine()); $sh = $this->setSearchHandler($unassigned_list); $sh->setFields(array('id', 'invoice_number', 'invoice_date', 'customer', 'description', 'net_value', 'tax_value', 'gross_value')); $db = DB::Instance(); $subquery = "select item_id from project_costs_charges where item_type='SI'"; $sh->addConstraint(new Constraint('id', 'not in', '(' . $subquery . ')')); $sh->setOrderby('invoice_number'); parent::index($unassigned_list, $sh); $this->view->set('unassigned_list', $unassigned_list); $this->setTemplateName('link_costs_charges'); }
public static function getProjectsByUserID($userID = null, $limit = null) { if ($userID === null) { return null; } $loggedInUserID = Session::getUserID(); $query = " SELECT pu.project_id AS id FROM " . self::DB_TABLE . " pu"; $query .= " INNER JOIN " . Project::DB_TABLE . " p ON"; $query .= " pu.project_id = p.id"; $query .= " WHERE pu.user_id = " . $userID; $query .= " AND pu.relationship != " . self::BANNED; // only show private projects if logged-in user is also a member if (!empty($loggedInUserID)) { $query .= " AND (p.private = 0"; $query .= " OR pu.project_id IN ("; $query .= " SELECT project_id FROM " . self::DB_TABLE; $query .= " WHERE user_id = " . $loggedInUserID; $query .= " AND relationship != " . self::BANNED; $query .= " ))"; } else { $query .= " AND p.private = 0"; } $query .= " ORDER BY p.title ASC"; if (!empty($limit)) { $query .= " LIMIT " . $limit; } $db = Db::instance(); $result = $db->lookup($query); if (!mysql_num_rows($result)) { return array(); } $projects = array(); while ($row = mysql_fetch_assoc($result)) { $projects[$row['id']] = Project::load($row['id']); } return $projects; }
<?php $title = 'Project Storage'; require './header.php'; $cards = fRecordSet::build('Card', array('uid=' => $_GET['cardid'])); if ($cards->count() == 0) { fURL::redirect("/kiosk/addcard.php?cardid=" . $_GET['cardid']); } $card = $cards->getRecord(0); $user = new User($card->getUserId()); $user->load(); if (isset($_POST['print'])) { $project = new Project($_POST['print']); $project->load(); if ($project->getUserId() != $user->getId()) { print "Incorrect project ID"; exit; } $data = array('storage_id' => $project->getId(), 'name' => $project->getName(), 'ownername' => $user->getFullName(), 'more_info' => $project->getDescription(), 'completion_date' => $project->getToDate()->format('Y/m/d'), 'max_extention' => "14"); $data_string = json_encode($data); $ch = curl_init('http://kiosk.london.hackspace.org.uk:12345/print/dnh'); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($data_string))); $result = curl_exec($ch); curl_close($ch); echo "<p>Your sticker is being printed now.</p>"; } $projects = fRecordSet::build('Project', array('state_id!=' => array('6', '7'), 'user_id=' => $user->getId())); ?>
<?php # edit_task.php # 1. Logic $task = new Task(); $task->load(Route::param('id')); $project = new Project(); $project->load($task->project_id); if (Input::posted()) { $task->fill(Input::all()); $task->save(); URL::redirect('/' . $project->slug); } Sticky::set('name', $task->name); Sticky::set('description', $task->description);