本文整理汇总了PHP中CCompany::store方法的典型用法代码示例。如果您正苦于以下问题:PHP CCompany::store方法的具体用法?PHP CCompany::store怎么用?PHP CCompany::store使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCompany
的用法示例。
在下文中一共展示了CCompany::store方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
public function import($AppUI)
{
$output = '';
$company_id = (int) w2PgetParam($_POST, 'company_id', 0);
if ($company_id == 0) {
if (isset($_POST['new_company'])) {
$companyName = w2PgetParam($_POST, 'new_company', 'New Company');
$company = new CCompany();
$company->company_name = $companyName;
$company->company_owner = $AppUI->user_id;
$AppUI->version_major <= 1 && $AppUI->version_minor <= 1 ? $company->store() : $company->store($AppUI);
$company_id = $company->company_id;
$output .= $AppUI->_('createcomp') . $companyName . '<br>';
echo $output;
} else {
$error = $AppUI->_('emptycomp');
return $error;
}
}
$result = $this->_processProject($AppUI, $company_id, $_POST);
if (is_array($result)) {
$AppUI->setMsg($result, UI_MSG_ERROR);
$AppUI->redirect('m=importers');
}
$this->project_id = $result;
$q = new DBQuery();
// Users Setup
if (isset($_POST['users']) && is_array($_POST['users']) && $_POST['nouserimport'] != "true") {
foreach ($_POST['users'] as $ruid => $r) {
$q->clear();
if (!empty($r['user_username'])) {
$result = $this->_processContact($AppUI, $r['user_username'], $company_id);
if (is_array($result)) {
$AppUI->setMsg($result, UI_MSG_ERROR);
$AppUI->redirect('m=importers');
}
$contact_id = $result;
//TODO: Replace with the regular create users functionality
$q->addInsert('user_username', $r['user_username']);
$q->addInsert('user_contact', $contact_id);
$q->addTable('users');
$q->exec();
$insert_id = db_insert_id();
$r['user_id'] = $insert_id;
} else {
$r['user_id'] = $r['user_userselect'];
}
if (!empty($r['user_id'])) {
$resources[$ruid] = $r;
}
}
}
// Tasks Setup
foreach ($_POST['tasks'] as $k => $task) {
$result = $this->_processTask($AppUI, $this->project_id, $task);
if (is_array($result)) {
$AppUI->setMsg($result, UI_MSG_ERROR);
$AppUI->redirect('m=importers');
}
$task_id = $result;
// Task Parenthood
$outline[$task['OUTLINENUMBER']] = $task_id;
$q->clear();
if (!strpos($task['OUTLINENUMBER'], '.')) {
$q->addUpdate('task_parent', $task_id);
$q->addWhere('task_id = ' . $task_id);
$q->addTable('tasks');
} else {
$parent_string = substr($task['OUTLINENUMBER'], 0, strrpos($task['OUTLINENUMBER'], '.'));
$parent_outline = isset($outline[$parent_string]) ? $outline[$parent_string] : $task_id;
$q->addUpdate('task_parent', $parent_outline);
$q->addWhere('task_id = ' . $task_id);
$q->addTable('tasks');
}
$q->exec();
$task['task_id'] = $task_id;
$tasks[$task['UID']] = $task;
// Resources (Workers)
if (count($task['resources']) > 0) {
$sql = "DELETE FROM user_tasks WHERE task_id = {$task_id}";
db_exec($sql);
$resourceArray = array();
foreach ($task['resources'] as $uk => $user) {
$alloc = $task['resources_alloc'][$uk];
if ($alloc > 0 && $resources[$user]['user_id'] > 0) {
$q->clear();
if (!in_array($resources[$user]['user_id'], $resourceArray)) {
$q->addInsert('user_id', $resources[$user]['user_id']);
$q->addInsert('task_id', $task_id);
$q->addInsert('perc_assignment', $alloc);
$q->addTable('user_tasks');
$q->exec();
}
$resourceArray[] = $resources[$user]['user_id'];
}
}
}
}
//dependencies have to be handled alone after all tasks have been saved since the
//predecessor (ms project term) task might come later and the associated task id
//.........这里部分代码省略.........
示例2: CustomFields
if (!$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
require_once $AppUI->getSystemClass('CustomFields');
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('Company');
if ($del) {
if (!$obj->canDelete($msg)) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
}
if ($msg = $obj->delete()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
} else {
$AppUI->setMsg('deleted', UI_MSG_ALERT, true);
$AppUI->redirect('m=companies');
}
} else {
if ($msg = $obj->store()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
$custom_fields = new CustomFields($m, 'addedit', $obj->company_id, 'edit');
$custom_fields->bind($_POST);
$sql = $custom_fields->store($obj->company_id);
// Store Custom Fields
$AppUI->setMsg(@$_POST['company_id'] ? 'updated' : 'added', UI_MSG_OK, true);
}
$AppUI->redirect();
}
示例3: die
<?php
/* $Id$ $URL$ */
if (!defined('W2P_BASE_DIR')) {
die('You should not access this file directly.');
}
$del = (int) w2PgetParam($_POST, 'del', 0);
$obj = new CCompany();
if (!$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
$action = $del ? 'deleted' : 'stored';
$result = $del ? $obj->delete($AppUI) : $obj->store($AppUI);
if (is_array($result)) {
$AppUI->setMsg($result, UI_MSG_ERROR, true);
$AppUI->holdObject($obj);
$AppUI->redirect('m=companies&a=addedit');
}
if ($result) {
$AppUI->setMsg('Company ' . $action, UI_MSG_OK, true);
$AppUI->redirect('m=companies');
} else {
$AppUI->redirect('m=public&a=access_denied');
}