本文整理汇总了PHP中Project::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::add方法的具体用法?PHP Project::add怎么用?PHP Project::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project::add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_project
function add_project()
{
$project = array();
$project['name'] = empty($_POST['name']) ? '' : $_POST['name'];
$project['type'] = empty($_POST['type']) ? '' : $_POST['type'];
$project['description'] = empty($_POST['description']) ? '' : $_POST['description'];
$project['lng'] = empty($_POST['lng']) ? '' : $_POST['lng'];
$project['lat'] = empty($_POST['lat']) ? '' : $_POST['lat'];
$project['zoom'] = empty($_POST['zoom']) ? '' : $_POST['zoom'];
$_project = new Project();
$ret = $_project->add($project);
if ($ret) {
$response = "success";
} else {
$response = "failed";
}
echo $response;
}
示例2: add
function add()
{
parent::add();
}
示例3: Project
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
/** @file
* @brief
* @since version 0.85
*/
include '../inc/includes.php';
if (empty($_GET["id"])) {
$_GET["id"] = '';
}
Session::checkLoginUser();
$project = new Project();
if (isset($_POST["add"])) {
$project->check(-1, CREATE, $_POST);
$newID = $project->add($_POST);
Event::log($newID, "project", 4, "maintain", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
if ($_SESSION['glpibackcreated']) {
Html::redirect($project->getFormURL() . "?id=" . $newID);
} else {
Html::back();
}
} else {
if (isset($_POST["delete"])) {
$project->check($_POST["id"], DELETE);
$project->delete($_POST);
Event::log($_POST["id"], "project", 4, "maintain", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
$project->redirectToList();
} else {
if (isset($_POST["restore"])) {
$project->check($_POST["id"], DELETE);
示例4: addProjectWrapper
function addProjectWrapper()
{
$name = Utils::getArrayValue($_POST, 'name');
$identifier = Utils::getArrayValue($_POST, 'identifier');
if (empty($identifier)) {
$identifier = $name;
}
$parent_id = Utils::getArrayValue($_POST, 'parent_id');
if (trim($identifier) === "") {
$identifier = $name;
}
print json_encode(Project::add(App::getClient(), $name, $identifier, $parent_id));
// TODO: inherit membership
// $members = Project::getMembers(App::getClient(), 17);
// echo "<PRE>";
// print_r($members);
// echo "<HR>";
// $members = Project::getMembers(App::getClient(), 223);
// print_r($members);
// #$members = Project::addMembers(App::getClient(), 223, array('user_id'));
// #print_r($members);
// echo "<HR>";
// $members = Project::getMembers(App::getClient(), 223);
// print_r($members);
// die;
}
示例5: eventSetProjectTask
/**
* Event method to set a project on a task.
* Get the last inserted id from the task and then check
* if there is a project then add to project_task
*/
function eventSetProjectTask(EventControler $evtcl)
{
$project_name = trim($evtcl->fields["project"]);
$idtask = $evtcl->insertid;
$q = new sqlQuery($this->getDbCon());
if ($project_name != '') {
$do_project = new Project();
$do_project_task = new ProjectTask();
$idproject = $do_project->getProjectIdByName($project_name);
if ($idproject !== false) {
$q->query("INSERT INTO project_task (idtask, idproject) VALUES (" . $idtask . ", " . $idproject . ")");
} else {
$do_project->addNew();
$do_project->iduser = $_SESSION['do_User']->iduser;
$do_project->name = $project_name;
$do_project->status = 'open';
$do_project->add();
$idproject = $do_project->getPrimaryKeyValue();
$q->query("INSERT INTO project_task (idtask, idproject) VALUES (" . $idtask . ", " . $idproject . ")");
}
}
}
示例6: testsperengine
//.........这里部分代码省略.........
SmartTest::instance()->canwe = "unassociate by deleting a bean?";
$anotherdrink = RedBean_OODB::dispense("whisky");
$anotherdrink->name = "bowmore";
$anotherdrink->age = 18;
$anotherdrink->singlemalt = 'y';
RedBean_OODB::set($anotherdrink);
RedBean_OODB::associate($anotherdrink, $john);
$hisdrinks = RedBean_OODB::getAssoc($john, "whisky");
if (count($hisdrinks) !== 1) {
die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
}
RedBean_OODB::trash($anotherdrink);
$hisdrinks = RedBean_OODB::getAssoc($john, "whisky");
if (count($hisdrinks) !== 0) {
die("<b style='color:red'>Error CANNOT:" . SmartTest::instance()->canwe);
}
SmartTest::instance()->progress();
SmartTest::instance()->canwe = "create parent child relationships?";
$pete = RedBean_OODB::dispense("person");
$pete->age = 48;
$pete->gender = "m";
$pete->name = "Pete";
$peteid = RedBean_OODB::set($pete);
$rob = RedBean_OODB::dispense("person");
$rob->age = 19;
$rob->name = "Rob";
$rob->gender = "m";
$saskia = RedBean_OODB::dispense("person");
$saskia->age = 20;
$saskia->name = "Saskia";
$saskia->gender = "f";
RedBean_OODB::set($saskia);
RedBean_OODB::set($rob);
RedBean_OODB::addChild($pete, $rob);
RedBean_OODB::addChild($pete, $saskia);
$children = RedBean_OODB::getChildren($pete);
$names = 0;
if (is_array($children) && count($children) === 2) {
foreach ($children as $child) {
if ($child->name === "Rob") {
$names++;
}
if ($child->name === "Saskia") {
$names++;
}
}
}
if (!$names) {
die("<b style='color:red'>Error CANNOT1:" . SmartTest::instance()->canwe);
}
$daddies = RedBean_OODB::getParent($saskia);
$daddy = array_pop($daddies);
if ($daddy->name === "Pete") {
$ok = 1;
} else {
$ok = 0;
}
if (!$ok) {
die("<b style='color:red'>Error CANNOT2:" . SmartTest::instance()->canwe);
}
SmartTest::instance()->progress();
SmartTest::instance()->canwe = "remove a child from a parent-child tree?";
RedBean_OODB::removeChild($daddy, $saskia);
$children = RedBean_OODB::getChildren($pete);
$ok = 0;
if (count($children) === 1) {
示例7: Project
<?php
include "threephp/THREE.php";
include "tpl/inc/board.php";
include "tpl/inc/street.php";
include "tpl/inc/bank.php";
include "tpl/inc/house.php";
include "tpl/inc/pawn.php";
include "tpl/inc/dice.php";
include "tpl/inc/game.php";
include "tpl/inc/logo.php";
include "tpl/inc/dialog.php";
$project = new Project(null, '{ "name":"Example" }');
$page = new Page($project, '{ "name":"Main", "file":"tpl/index.php", "path":"index" }');
$project->add($page);
$scene = new Scene($page, '{ "resize":"true", "stat":"true", "click":"true", "info":"true", "control":"true", "tween":"true", "physics":"true" }');
$page->add($scene);
$scene->add(new Bank($scene, '{ "amount": 24500000 }'));
$page->add(new Console($page, '{}'));
$board = new Board($scene, '{}');
$scene->add($board);
$scene->add(new Game($scene, '{}'));
$board->add(new Street($board, '{ "x":-406, "z":406, "label":"Start" }'));
$board->add(new Street($board, '{ "x":-406, "z":203, "rotation":' . (0 - M_PI / 2) . ', "label":"Business Park", "type":"Bedrijfspand", "city":"Vught", "cost":1500000, "profit":12250000 }'));
$board->add(new Street($board, '{ "x":-406, "z":0, "rotation":' . (0 - M_PI / 2) . ', "label":"Koningsweg", "type":"Kantoor", "city":"\'s-Hertogenbosch", "cost":2000000, "profit":13750000 }'));
$board->add(new Street($board, '{ "x":-406, "z":-203, "rotation":' . (0 - M_PI / 2) . ', "label":"Hooge Steenweg", "type":"Winkels en woningen", "city":"\'s-Hertogenbosch", "cost":3000000, "profit":15000000 }'));
$board->add(new Street($board, '{ "x":-406, "z":-406, "label":"Op bezoek" }'));
$board->add(new Street($board, '{ "x":-203, "z":-406, "rotation":' . (0 - M_PI) . ', "label":"Noble", "type":"Restaurant", "city":"\'s-Hertogenbosch", "cost":3000000, "profit":17500000 }'));
$board->add(new Street($board, '{ "x":0, "z":-406, "rotation":' . (0 - M_PI) . ', "label":"Schapenmarkt", "type":"Winkels", "city":"\'s-Hertogenbosch", "cost":4000000, "profit":20000000 }'));
$board->add(new Street($board, '{ "x":203, "z":-406, "rotation":' . (0 - M_PI) . ', "label":"Kerkstraat", "type":"Winkels", "city":"\'s-Hertogenbosch", "cost":4500000, "profit":21500000 }'));
$board->add(new Street($board, '{ "x":406, "z":-406, "label":"Vrij parkeren" }'));
示例8: add
public function add()
{
//Subject,Type,CreateTime,PublishTime,Status,UserId,Department,Team,Hours,Developer,Schedule,Detail,Pv,Uv,Fans,Summary,Laud
$res = array();
$project = new Project();
$project->Subject = $this->Subject;
$project->Detail = $this->Detail;
$project->Type = $this->Type;
$project->CreateTime = date('Y-m-d H:i:s');
$project->PublishTime = $this->PublishTime;
$project->Status = 1;
$project->UserId = $_SESSION['userid'];
$project->Department = $this->Department;
$project->Team = $this->Team;
$project->Hours = 0;
$project->Developer = '';
$project->Schedule = 0;
$project->Pv = 0;
$project->Uv = 0;
$project->Fans = 0;
$project->Summary = '';
$project->Laud = 0;
$result = $project->add();
if ($result > 0) {
$res['Success'] = true;
$res['Message'] = "需求提交成功";
$res['NewId'] = $result;
//发送部门老大emailt通知
$user = new User();
$userMode = $user->getVerifyer($project->Department);
$res['Email'] = $userMode['Email'];
if (!empty($userMode['Email'])) {
$mail = new SaeMail();
$verifyUrl = URL_WEBSITE . "/basic/project_detail.php?id=" . $result . "&selected=2";
$res['Email'] = $userMode['Email'];
//发送邮件操作
$keys = array();
$keys['to'] = $userMode['Email'];
if ($project->Department == 101) {
//大客户事业部需要抄送
$keys['cc'] = 'ericzhang@thindov.com,orien.young@thindov.com,endertan@thindov.com,sauwe@qq.com';
}
$keys['from'] = "noreply@ikeluo.com";
$keys['smtp_port'] = "25";
$keys['smtp_username'] = "noreply@ikeluo.com";
$keys['smtp_password'] = "wswlxh987@";
$mailsubject = "技术开发需求审核:" . $project->Subject;
$mailbody = "Dear " . $userMode['Name'];
$mailbody .= "<br />";
$mailbody .= "<br />";
$mailbody .= "您好,您的部门有新的技术开发需求,需要您审核。需求如下:";
$mailbody .= "<br />";
$mailbody .= "<br />";
$mailbody .= "主题:" . $project->Subject;
$mailbody .= "<br />";
$mailbody .= "<br />";
$mailbody .= "描述:" . $project->Detail;
$mailbody .= "<br />";
$mailbody .= "<br />";
$mailbody .= "请点击以下链接进入审核:";
$mailbody .= "<br />";
$mailbody .= "<br />";
$mailbody .= "<a href='" . $verifyUrl . "'>" . $verifyUrl . "</a>";
$mailbody .= "<br />";
$mailbody .= "<br />";
$mailbody .= "——深圳尚道微营销有限公司 技术中心";
$mailbody .= "<br />";
$mailbody .= "<br />";
$mailbody .= "该邮件由“技术开发管理平台”系统发出,无需回复。";
$keys['subject'] = $mailsubject;
$keys['content'] = $mailbody;
$keys['content_type'] = 'HTML';
$keys['smtp_host'] = "smtp.qq.com";
$mail->setOpt($keys);
$ret = $mail->send();
//if ($ret === false)
//var_dump($mail->errno(), $mail->errmsg());
$mail->clean();
}
} else {
$res['Success'] = false;
$res['Message'] = "需求提交失败,请联系技术部";
}
echo json_encode($res);
exit;
}
示例9: eventImportAccount
function eventImportAccount(EventControler $evtcl)
{
$msg = "";
$uploaded_file = $_FILES['fields']['name']['import_account'];
$target_path = 'files/' . $uploaded_file;
if (!move_uploaded_file($_FILES['fields']['tmp_name']['import_account'], $target_path)) {
$msg = "There was an error uploading the file, please try again!";
} else {
chmod($target_path, 0755);
if (file_exists($target_path)) {
//$xml = simplexml_load_file($_SERVER['DOCUMENT_ROOT']."/".$target_path);
$str_xml = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/" . $target_path);
$str_xml = preg_replace('/[^(\\x20-\\x7F)]*/', '', $str_xml);
$xml = simplexml_load_string($str_xml);
echo '<pre>';
print_r($xml);
echo '</pre>';
die;
if ($xml !== FALSE) {
$c_cnt = count($xml->contact);
if ($c_cnt) {
for ($i = 0; $i < $c_cnt; $i++) {
$do_contact = new Contact();
$contact = $xml->contact[$i];
$do_contact->firstname = $contact->firstname;
$do_contact->lastname = $contact->lastname;
$do_contact->position = $contact->position;
$do_contact->company = $contact->company;
$do_contact->idcompany = $contact->idcompany;
$do_contact->iduser = $_SESSION['do_User']->iduser;
$do_contact->picture = $contact->picture;
$do_contact->summary = $contact->summary;
$do_contact->birthday = $contact->birthday;
$do_contact->portal_code = $contact->portal_code;
$do_contact->fb_userid = $contact->fb_userid;
$do_contact->tw_user_id = $contact->tw_user_id;
$do_contact->email_optout = $contact->email_optout;
$do_contact->add();
$lastInsertedContId = $do_contact->getPrimaryKeyValue();
/**
*Contact Address
*/
$ca_cnt = count($contact->contact_address);
if ($ca_cnt) {
for ($ca_cnt_i = 0; $ca_cnt_i < $ca_cnt; $ca_cnt_i++) {
$do_contact_address = new ContactAddress();
$contact_address = $contact->contact_address[$ca_cnt_i];
$do_contact_address->city = $contact_address->city;
$do_contact_address->country = $contact_address->country;
$do_contact_address->state = $contact_address->state;
$do_contact_address->street = $contact_address->street;
$do_contact_address->zipcode = $contact_address->zipcode;
$do_contact_address->idcontact = $lastInsertedContId;
$do_contact_address->address = $contact_address->address;
$do_contact_address->address_type = $contact_address->address_type;
$do_contact_address->add();
$do_contact_address->free();
}
}
/**
*Contact Email
*/
$ce_cnt = count($contact->contact_email);
if ($ce_cnt) {
for ($ce_cnt_i = 0; $ce_cnt_i < $ce_cnt; $ce_cnt_i++) {
$do_contact_email = new ContactEmail();
$contact_email = $contact->contact_email[$ce_cnt_i];
$do_contact_email->idcontact = $lastInsertedContId;
$do_contact_email->email_address = $contact_email->email_address;
$do_contact_email->email_type = $contact_email->email_type;
$do_contact_email->email_isdefault = $contact_email->email_isdefault;
$do_contact_email->add();
$do_contact_email->free();
}
}
/**
*Contact Phone
*/
$cp_cnt = count($contact->contact_phone);
if ($cp_cnt) {
for ($cp_cnt_i = 0; $cp_cnt_i < $cp_cnt; $cp_cnt_i++) {
$do_contact_phone = new ContactPhone();
$contact_phone = $contact->contact_phone[$cp_cnt_i];
$do_contact_phone->phone_number = $contact_phone->phone_number;
$do_contact_phone->phone_type = $contact_phone->phone_type;
$do_contact_phone->idcontact = $lastInsertedContId;
$do_contact_phone->add();
$do_contact_phone->free();
}
}
/**
*Contact Note
*/
$cn_cnt = count($contact->contact_note);
if ($cn_cnt) {
for ($cn_cnt_i = 0; $cn_cnt_i < $cn_cnt; $cn_cnt_i++) {
$do_contact_note = new ContactNotes();
$contact_note = $contact->contact_note[$cn_cnt_i];
$do_contact_note->idcontact = $lastInsertedContId;
$do_contact_note->note = $contact_note->note;
//.........这里部分代码省略.........