本文整理汇总了PHP中Project::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::update方法的具体用法?PHP Project::update怎么用?PHP Project::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::update方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleRequest
protected function handleRequest(array $request)
{
$projectId = $request[self::FIELD_PROJECT_ID];
$title = $request[self::FIELD_TITLE];
$description = $request[self::FIELD_DESCRIPTION];
Project::update($projectId, $title, $description);
}
示例2: update
public static function update($id)
{
self::check_logged_in();
$params = $_POST;
$attributes = array('id' => $id, 'name' => $params['name']);
$project = new Project($attributes);
$errors = $project->validateProject();
if (count($errors) == 0) {
$project->update();
Redirect::to('/project', array('message' => 'Project edited successfully'));
} else {
View::make('project/edit.html', array('errors' => $errors, 'attributes' => $attributes));
}
}
示例3: update
/**
* Update the specified resource in storage.
*
* @param Project $project
* @return Response
*/
public function update($project)
{
$input = Input::all();
$project->title = $input['title'];
$project->contact_firstname = $input['contact_firstname'];
$project->contact_lastname = $input['contact_lastname'];
$project->contact_email = $input['contact_email'];
$project->contact_phone_number = $input['contact_phone_number'];
$project->contact_phone_number_ext = $input['contact_phone_number_ext'];
$project->description = $input['description'];
$project->location = $input['location'];
$project->expected_time = $input['expected_time'];
$project->motivation = $input['motivation'];
$project->resources = $input['resources'];
$project->constraints = $input['constraints'];
$project->state = $input['state'];
$input['tags'] = isset($input['tags']) ? $input['tags'] : array();
//verify that there are some goals and tags in the $input
$input['goals'] = isset($input['goals']) ? $input['goals'] : array();
if ($project->update()) {
// Delete project goals and then re-create them
$project->goals()->delete();
$loop_index = 0;
foreach ($input['goals'] as $goal) {
//Ignore empty goals
if ($goal == '') {
$loop_index++;
continue;
} else {
$goalObj = new Goal();
$goalObj->goal = $goal;
// The completed variable posted is an array containing the indexes for the goals that are marked as complete
// This will swap the array's index with the value (ie. [0] => a, [1] => b will become [a] => 0, [b] => 1)
// This then allows us to see if the current loop index has a goal that is complete without needing to use a for loop
$completed = isset($input['completed']) ? array_flip($input['completed']) : array();
if (isset($completed[$loop_index])) {
$goalObj->complete = 1;
} else {
$goalObj->complete = 0;
}
$project->goals()->save($goalObj);
}
$loop_index++;
}
// Delete project tags and then re-create them
$project->tags()->detach();
foreach ($input['tags'] as $tag) {
if ($tag == '') {
continue;
} else {
$tagObj = Tag::find($tag);
$project->tags()->attach($tagObj);
}
}
return Redirect::to('/admin/project/' . $project->id . '/edit')->with('info', 'The project has been updated.');
} else {
return Redirect::to('/admin/project/' . $project->id . '/edit')->withErrors($project->errors());
}
}
示例4: Template_API
include_once APP_INC_PATH . "class.status.php";
include_once APP_INC_PATH . "class.workflow.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", "projects");
$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", Project::insert());
} elseif (@$HTTP_POST_VARS["cat"] == "update") {
$tpl->assign("result", Project::update());
} elseif (@$HTTP_POST_VARS["cat"] == "delete") {
Project::remove();
}
$tpl->assign("active_projects", Project::getAssocList(Auth::getUserID(), true));
if (@$HTTP_GET_VARS["cat"] == "edit") {
$tpl->assign("info", Project::getDetails($HTTP_GET_VARS["id"]));
}
$tpl->assign("list", Project::getList());
$tpl->assign("user_options", User::getActiveAssocList(false, NULL, false, false, true));
$tpl->assign("status_options", Status::getAssocList());
$tpl->assign("customer_backends", Customer::getBackendList());
$tpl->assign("workflow_backends", Workflow::getBackendList());
} else {
$tpl->assign("show_not_allowed_msg", true);
}
示例5: sprintf
} else {
if (isset($_POST["restore"])) {
$project->check($_POST["id"], DELETE);
$project->restore($_POST);
Event::log($_POST["id"], "project", 4, "maintain", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
$project->redirectToList();
} else {
if (isset($_POST["purge"])) {
$project->check($_POST["id"], PURGE);
$project->delete($_POST, 1);
Event::log($_POST["id"], "project", 4, "maintain", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
$project->redirectToList();
} else {
if (isset($_POST["update"])) {
$project->check($_POST["id"], UPDATE);
$project->update($_POST);
Event::log($_POST["id"], "project", 4, "maintain", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
Html::back();
} else {
Html::header(Project::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "tools", "project");
if (isset($_GET['showglobalgantt']) && $_GET['showglobalgantt']) {
$project->showGantt(-1);
} else {
$project->display($_GET);
}
Html::footer();
}
}
}
}
}
示例6: doEdit
function doEdit()
{
if (isset($_POST['submit'])) {
$PROJECTID = $_POST['projectid'];
$PROJECTNUMBER = $_POST['projectnumber'];
$NAME = $_POST['projectname'];
$CLIENTNAME = $_POST['clientname'];
$CLIENTCONTACTS = $_POST[''];
$PROJECTTYPEID = $_POST['projecttype'];
$STARTDATE = $_POST['startdate'];
$ENDDATE = $_POST['enddate'];
$DAYS = $_POST['days'];
$AMOUNT = $_POST['amount'];
$PROJECTSTATUS = $_POST['status'];
$SECTOR = $_POST['sector'];
$BUREAU = $_POST['bureau'];
$SCHOOL = $_POST['school'];
$project = new Project();
$project->project_id = $PROJECTID;
$project->project_number = $PROJECTNUMBER;
$project->project_name = $NAME;
$project->client_contacts = $CLIENTCONTACTS;
$project->project_type_id = $PROJECTTYPEID;
$project->client_name = $CLIENTNAME;
$project->start_date = $STARTDATE;
$project->end_date = $ENDDATE;
$project->days = $DAYS;
$project->total_amount = $AMOUNT;
$project->project_status = $PROJECTSTATUS;
$project->project_bureau_id = $BUREAU;
$project->project_school_id = $SCHOOL;
$project->project_sector_id = $SECTOR;
}
if ($PROJECTID == "") {
message('ID Number is required!', "error");
redirect('index.php?view=edit&id=' . $PROJECTID);
} elseif ($NAME == "") {
message('Project Name is required!', "error");
redirect('index.php?view=edit&id=' . $PROJECTID);
} elseif ($PROJECTNUMBER == "") {
message('Project Number is required!', "error");
redirect('index.php?view=edit&id=' . $PROJECTID);
} elseif ($CLIENTCONTACTS == "") {
message('Client Contacts is required!', "error");
redirect('index.php?view=edit&id=' . $PROJECTID);
} elseif ($PROJECTTYPEID == "") {
message('Project type is required!', "error");
redirect('index.php?view=edit&id=' . $PROJECTID);
} elseif ($CLIENTNAME == "") {
message('Client is required!', "error");
redirect('index.php?view=edit&id=' . $PROJECTID);
} elseif ($STARTDATE == "") {
message('Start is required!', "error");
redirect('index.php?view=edit&id=' . $PROJECTID);
} elseif ($ENDDATE == "") {
message('End is required!', "error");
redirect('index.php?view=edit&id=' . $PROJECTID);
} elseif ($AMOUNT == "") {
message('Amount is required!', "error");
redirect('index.php?view=edit&id=' . $PROJECTID);
} elseif ($DAYS == "") {
message('Days is required!', "error");
redirect('index.php?view=edit&id=' . $PROJECTID);
} elseif ($PROJECTSTATUS == "") {
message('Project Status is required!', "error");
redirect('index.php?view=edit&id=' . $PROJECTID);
} elseif ($BUREAU == "") {
message('Bureau is required!', "error");
redirect('index.php?view=edit&id=' . $PROJECTID);
} elseif ($SECTOR == "") {
message('Sector is required!', "error");
redirect('index.php?view=edit&id=' . $PROJECTID);
} elseif ($SCHOOL == "") {
message('School is required!', "error");
redirect('index.php?view=edit&id=' . $PROJECTID);
} else {
$project->update($_GET['id']);
message('Project information updated successfully!', "info");
redirect('index.php');
}
}
示例7: Template_Helper
* 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/projects.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_MANAGER) {
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(Project::insert(), array(1 => array(ev_gettext('Thank you, the project was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the new project.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this new project.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
Misc::mapMessages(Project::update(), array(1 => array(ev_gettext('Thank you, the project was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the project information.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this project.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
Misc::mapMessages(Project::remove(), array(1 => array(ev_gettext('Thank you, the project was deleted successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to delete the project.'), Misc::MSG_ERROR)));
}
$tpl->assign('active_projects', Project::getAssocList(Auth::getUserID(), true));
if (@$_GET['cat'] == 'edit') {
$tpl->assign('info', Project::getDetails($_GET['id']));
}
$tpl->assign('list', Project::getList());
$tpl->assign('user_options', User::getActiveAssocList());
$tpl->assign('status_options', Status::getAssocList());
$tpl->assign('customer_backends', CRM::getBackendList());
$tpl->assign('workflow_backends', Workflow::getBackendList());
$tpl->displayTemplate();
示例8: process_request
/**
* Check if a file is specified for loading.
*
* Also save changes to it if posted.
*
* @since 1.2.0 Added custom save destination; under PME content directory.
* @since 1.1.0 Improved sprintf calls for localization purposes.
* @since 1.0.0
*/
public static function process_request()
{
// Skip if no file is specified
if (!isset($_REQUEST['pofile'])) {
return;
}
// If file was specified via $_POST, check for manage nonce action
if (isset($_POST['pofile']) && (!isset($_POST['_pomoeditor_nonce']) || !wp_verify_nonce($_POST['_pomoeditor_nonce'], 'pomoeditor-manage-' . md5($_POST['pofile'])))) {
wp_die(__('Cheatin’ uh?'), 403);
}
// Create the source/destination paths
$file = $_REQUEST['pofile'];
$source = realpath(WP_CONTENT_DIR . '/' . $file);
// Check that the source exists
if (strtolower(pathinfo($source, PATHINFO_EXTENSION)) != 'po') {
/* Translators: %s = full path to file */
wp_die(sprintf(__('The requested file is not supported: %s', 'pomo-editor'), $source), 400);
} elseif (!file_exists($source)) {
/* Translators: %s = full path to file */
wp_die(sprintf(__('The requested file cannot be found: %s', 'pomo-editor'), $source), 404);
} elseif (!is_path_permitted($source)) {
/* Translators: %s = full path to file */
wp_die(sprintf(__('The requested file is not within one of the permitted paths: %s', 'pomo-editor'), $source), 403);
} elseif (!is_writable($source)) {
/* Translators: %s = full path to file */
wp_die(sprintf(__('The requested file is not writable: %s', 'pomo-editor'), $source), 403);
} elseif (isset($_POST['podata'])) {
// Load
$project = new Project($source);
$project->load();
// Update
$project->update(json_decode(stripslashes($_POST['podata']), true), true);
// Create destination from $source
$destination = $source;
// If the destination isn't already in the PME content directory, prepend it
if (strpos($file, 'pomo-editor/') !== 0) {
$destination = str_replace(WP_CONTENT_DIR, PME_CONTENT_DIR, $source);
$file = 'pomo-editor/' . $file;
}
// Save
$project->export($destination);
// Redirect
wp_redirect(admin_url("tools.php?page=pomo-editor&pofile={$file}&changes-saved=true"));
exit;
}
}
示例9: Project
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")).'</div>';
}
if (! $error)
{
$project = new Project($db);
$project->fetch($_POST["id"]);
$project->ref = $_POST["ref"];
$project->title = $_POST["title"];
$project->socid = $_POST["socid"];
$project->description = $_POST["description"];
$project->public = $_POST["public"];
$project->date_start = empty($_POST["project"])?'':dol_mktime(12,0,0,$_POST['projectmonth'],$_POST['projectday'],$_POST['projectyear']);
$project->date_end = empty($_POST["projectend"])?'':dol_mktime(12,0,0,$_POST['projectendmonth'],$_POST['projectendday'],$_POST['projectendyear']);
$result=$project->update($user);
$_GET["id"]=$project->id; // On retourne sur la fiche projet
}
else
{
$_GET["id"]=$_POST["id"];
$_GET['action']='edit';
}
}
// Build doc
if (GETPOST('action') == 'builddoc' && $user->rights->projet->creer)
{
$project = new Project($db);
$project->fetch($_GET['id']);
示例10: verify
public function verify()
{
$res = array();
$res['Success'] = false;
if ($this->Action > 1) {
//不通过,删除操作
$hours = new Hours();
$hours->Id = $this->Id;
$result = $hours->delete();
if ($result > 0) {
$res['Success'] = true;
$res['Message'] = "删除成功";
} else {
$res['Message'] = "删除失败";
}
} else {
//通过,计入项目总工时
$hours = new Hours();
$hours->Id = $this->Id;
$hours->Ratio = $this->Ratio;
$hours->Hours2 = $this->Hours2;
$result = $hours->update();
if ($result > 0) {
//审核成功
$project = new Project();
$project->setValue($this->ProjectId);
$project->Hours = $project->Hours + $hours->Hours2;
$project->update();
$res['Success'] = true;
$res['Message'] = "审核通过";
$res['NewId'] = $this->Id;
} else {
$res['Success'] = false;
$res['Message'] = "审核失败";
}
}
echo json_encode($res);
exit;
}
示例11: _reset_date_task
function _reset_date_task(&$db, $id_project, $velocity)
{
global $user;
if ($velocity == 0) {
return false;
}
$project = new Project($db);
$project->fetch($id_project);
$sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "projet_task\n\tWHERE fk_projet=" . $id_project . " AND progress<100\n\tORDER BY rang";
$res = $db->query($sql);
$current_time = time();
while ($obj = $db->fetch_object($res)) {
$task = new Task($db);
$task->fetch($obj->rowid);
$task->fetch_optionals($obj->rowid);
// Otherwise they are scratched in the update
if ($task->progress == 0) {
$task->date_start = $current_time;
}
$task->date_end = _get_delivery_date_with_velocity($db, $task, $velocity, $current_time);
$current_time = $task->date_end;
$task->update($user);
}
$project->date_end = $current_time;
$project->update($user);
}
示例12: effect
public function effect()
{
$res = array();
$project = new Project();
$project->setValue($this->ProjectId);
if ($project->Url != $this->Url) {
//生产二维码
$project->Url = $this->Url;
$destination_folder = date("Y") . "/";
//上传文件路径
$filenamenew = uniqid(date("Ymd"), true) . '.png';
$destination = $destination_folder . $filenamenew;
$stor = new Storage();
if (!empty($project->QrCode)) {
$stor->delete(FILE_DOMAIN, $project->QrCode);
}
$project->QrCode = $destination;
$url = urlencode($project->Url);
$qrcode = URL_WEBSITE . '/basic/handles/qrcode.php?Url=' . $url;
$f = new Fetchurl();
$imageData = $f->fetch($qrcode);
$stor->write(FILE_DOMAIN, $project->QrCode, $imageData);
}
$project->Pv = $this->Pv;
$project->Uv = $this->Uv;
$project->Fans = $this->Fans;
$project->Summary = $this->Summary;
$project->Laud = $this->Laud;
//print_r($project);
$result = $project->update();
if ($result > 0) {
$res['Success'] = true;
$res['Message'] = "更新成功";
//发送部门老大emailt通知
} else {
$res['Success'] = false;
$res['Message'] = "没有更新任何数据";
}
echo json_encode($res);
exit;
}
示例13: updateSettings
public function updateSettings(Project $project)
{
$project->update(Input::only('closed_statuses', 'workboard_mode'));
Flash::success('The project settings have been updated');
return Redirect::back();
}
示例14: run_trigger
//.........这里部分代码省略.........
return -1;
}
TGrappeFruit::createTasks($object);
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
} elseif ($action === 'PROJECT_MODIFY') {
if (!TGrappeFruit::checkBudgetNotEmpty($object)) {
return -1;
}
if (!TGrappeFruit::checkDateEndNotEmpty($object)) {
return -1;
}
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
} elseif ($action === 'PROPAL_CREATE') {
$db = $this->db;
if (!empty($conf->global->GRAPEFRUIT_LINK_PROPAL_2_PROJECT)) {
dol_include_once('/projet/class/project.class.php');
$projId = 0;
$sql = "SELECT p.rowid AS rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "projet as p";
$sql .= " WHERE p.fk_soc = " . $object->socid;
$sql .= " ORDER BY p.dateo DESC";
$sql .= " LIMIT 1";
$resql = $db->query($sql);
if ($resql) {
while ($line = $db->fetch_object($resql)) {
$projId = $line->rowid;
}
}
//On fetch le projet
$projet = new Project($db);
$projet->fetch($projId);
//TODO Ajouter la propale au projet
//var_dump($object->table_element, $object->id);exit;
$projet->update_element($object->table_element, $object->id);
}
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
} elseif ($action == 'ORDER_SUPPLIER_DISPATCH') {
// classify supplier order delivery status
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
if (!empty($conf->commande->enabled) && !empty($conf->fournisseur->enabled) && !empty($conf->global->GRAPEFRUIT_SUPPLIER_ORDER_CLASSIFY_RECEIPT_ORDER)) {
dol_include_once('/grapefruit/class/supplier.commande.dispatch.class.php');
$qtydelivered = array();
$qtywished = array();
$supplierorderdispatch = new CommandeFournisseurDispatchATM($this->db);
$filter = array('t.fk_commande' => $object->id);
if (!empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS)) {
$filter['t.status'] = 1;
}
$ret = $supplierorderdispatch->fetchAll('', '', 0, 0, $filter);
if ($ret < 0) {
$this->error = $supplierorderdispatch->error;
$this->errors = $supplierorderdispatch->errors;
return $ret;
} else {
if (is_array($supplierorderdispatch->lines) && count($supplierorderdispatch->lines) > 0) {
//Build array with quantity deliverd by product
foreach ($supplierorderdispatch->lines as $line) {
if (!empty($line->fk_product)) {
$qtydelivered[$line->fk_product] += $line->qty;
}
}
foreach ($object->lines as $line) {
if (!empty($line->fk_product)) {
$qtywished[$line->fk_product] += $line->qty;
}
}
开发者ID:ATM-Consulting,项目名称:dolibarr_module_grapefruit,代码行数:67,代码来源:interface_99_modGrapeFruit_GrapeFruittrigger.class.php