本文整理汇总了PHP中project::fill方法的典型用法代码示例。如果您正苦于以下问题:PHP project::fill方法的具体用法?PHP project::fill怎么用?PHP project::fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类project
的用法示例。
在下文中一共展示了project::fill方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: project
<h1><?php
echo $lang['common_projects'];
?>
</h1>
<?php
$projectInst = new project();
if (!$loginInst->isCustomer()) {
#######################################################################
## perform action
$status = 1;
if (tool::securePost('action') == "save" && tool::securePost('id')) {
# fill project with submitted data
$projectInst->id = tool::securePost('id');
$projectInst->fill(tool::securePostAll());
$status = $projectInst->update();
} elseif (tool::securePost('action') == "save") {
$projectInst->fill(tool::securePostAll());
$status = $projectInst->insert();
}
if (tool::securePost('action') == "delete") {
$projectInst->id = tool::securePost('id');
$projectInst->delete();
}
if (tool::securePost('action') == "edit") {
$status = 0;
$projectInst->activate(tool::securePost('id'));
}
#######################################################################
## make edit / new form
示例2: foreach
}
}
if ($_POST['question_t2_answer']) {
// Update tariffs with new end date
if ($_POST['projects_end_date'] > $administration_project->end_date && $administration_project->end_date != 0 || $_POST['projects_end_date'] == 0) {
$tariffs_array = $administration_project->has_tariffs('tariffs_end_date', '=', tep_strftime(DATE_FORMAT_DATABASE, $administration_project->end_date));
} else {
$tariffs_array = $administration_project->has_tariffs('tariffs_start_date', '<=', tep_strftime(DATE_FORMAT_DATABASE, $_POST['projects_end_date']), 'AND', 'tariffs_end_date', '>', tep_strftime(DATE_FORMAT_DATABASE, $_POST['projects_end_date']));
}
for ($index = 0; $index < sizeof($tariffs_array); $index++) {
$tariffs_array[$index]->end_date = $_POST['projects_end_date'];
$tariffs_array[$index]->save();
}
}
// Finally save the project
$administration_project->fill($_POST['projects_name'], $_POST['projects_description'], $_POST['projects_customers_contact_name'], $_POST['projects_customers_reference'], $_POST['projects_start_date'], $_POST['projects_end_date'], $_POST['projects_calculated_hours'], $_POST['projects_calculated_hours_period'], $_POST['projects_business_units_id'], $_POST['projects_customers_id']);
$administration_project->save();
// Clear all values except mPath
foreach ($_POST as $key => $value) {
if ($key != 'mPath') {
unset($_POST[$key]);
}
}
}
}
}
}
}
}
break;
case 'delete_entry':
示例3: strtolower
# new_project.php
# 1. logic
AUTH::kickout('login');
$projects = new Projects_Collection();
$projects->where(['deleted' => '0']);
$projects->where(['user_id' => AUTH::user_id()]);
$projects->get();
if (Input::posted()) {
$slug = Input::get('project_name');
$slug = strtolower($slug);
$slug = explode(" ", $slug);
$slug = implode("-", $slug);
$deadline = Input::get('deadline');
$deadline = intval($deadline);
$project = new project();
$project->fill(Input::all());
$project->date = date('Y-m-d H:i:s');
$project->slug = $slug;
$project->user_id = Auth::user_id();
if (Input::get('project_name') != "" || Input::get('project_description') != "") {
$project->save();
URL::redirect('/' . $project->slug);
}
URL::redirect('/new_project');
}
$title = 'New Project';
# 2. views
include VIEWS . 'header.php';
include VIEWS . 'new_project.php';
include VIEWS . 'footer.php';
示例4: create_project
/**
* Create a new project
*
* @param array $input
* @return array
*/
public static function create_project($input)
{
$rules = array('name' => 'required|max:250');
$validator = \Validator::make($input, $rules);
if (!$validator->valid()) {
return array('success' => false, 'errors' => $validator);
}
$fill = array('name' => $input['name']);
$project = new project();
$project->fill($fill);
$project->save();
/* Assign selected users to the project */
if (isset($input['user']) && count($input['user']) > 0) {
foreach ($input['user'] as $id) {
$project->assign_user($id);
}
}
return array('project' => $project, 'success' => true);
}