本文整理汇总了PHP中Issue::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Issue::save方法的具体用法?PHP Issue::save怎么用?PHP Issue::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Issue
的用法示例。
在下文中一共展示了Issue::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add()
{
$config = ['upload_path' => 'upload', 'allowed_types' => 'gif|jpg|png', 'max_size' => 250, 'max_width' => 1920, 'max_heigh' => 1080];
$this->load->library('upload', $config);
$this->load->model('Publication');
$publications = $this->Publication->get();
$publication_form_options = [];
foreach ($publications as $id => $publication) {
$publication_form_options[$id] = $publication->publication_name;
}
$this->load->library('form_validation');
$this->form_validation->set_rules([['field' => 'publication_id', 'label' => 'Publication', 'rules' => 'required'], ['field' => 'issue_number', 'label' => 'Issue number', 'rules' => 'required|is_numeric'], ['field' => 'issue_date_publication', 'label' => 'Publication date', 'rules' => 'required|callback_date_validation']]);
$this->form_validation->set_error_delimiters('<div class="alert alert-error">', '</div>');
$check_file_upload = FALSE;
if (isset($_FILES['issue_cover']['error']) && $_FILES['issue_cover']['error'] != 4) {
$check_file_upload = TRUE;
}
if (!$this->form_validation->run() || $check_file_upload && !$this->upload->do_upload('issue_cover')) {
$this->load->view('bootstrap/main', ['main' => 'magazines/magazine_form', 'publication_form_options' => $publication_form_options]);
} else {
$this->load->model('Issue');
$issue = new Issue();
$issue->publication_id = $this->input->post('publication_id');
$issue->issue_number = $this->input->post('issue_number');
$issue->issue_date_publication = $this->input->post('issue_date_publication');
$upload_data = $this->upload->data();
if (isset($upload_data['file_name'])) {
$issue->issue_cover = $upload_data['file_name'];
}
$issue->save();
$this->load->view('bootstrap/main', ['main' => 'magazines/magazine_form_success', 'issue' => $issue]);
}
}
示例2: store
public function store()
{
$validator = Validator::make(Input::all(), Issue::$rules, Issue::$messages);
//if($validator->passes()){
$issue = new Issue();
$issue->summary = Input::get('summary');
$issue->detail = Input::get('detail');
$issue->budget = 0.0;
$issue->currentState = "TO-DO";
$issue->points = Input::get('points');
$issue->labels = Input::get('labels');
$issue->iterationid = Input::get('iterationid');
$categoryId = Input::get('categoryid');
if ($categoryId == 0) {
//crear categoria
$category = new Category();
$category->name = Input::get('category_name');
$category->save();
$issue->categoryid = $category->id;
} else {
$issue->categoryid = $categoryId;
}
$issue->save();
return Redirect::to('/iterations/' . $issue->iterationid)->with('message', 'Historia creada con exito');
/*}else{
return Redirect::to('iterations/'. Input::get('iterationid'))
->with('error', 'Ocurrieron los siguientes errores')
->withErrors($validator)
->withInput();
}*/
}
示例3: add
public function add()
{
$this->load->helper('url');
$this->load->library('session');
$this->load->model('My_User');
$this->load->library('table');
$this->load->model(array('Issue', 'Publication'));
$this->load->view('bootstrap/header');
$upload_config = array('upload_path' => 'upload', 'allowed_types' => 'gif|png|jpg', 'max_size' => 600, 'max_width' => 1920, 'max_height' => 1080);
$this->load->library('upload', $upload_config);
$this->load->helper('form');
$this->load->model("Publication");
$publications = $this->Publication->get();
$publication_form_options = array();
foreach ($publications as $id => $publication) {
$publication_form_options[$id] = $publication->publication_name;
}
$this->load->library('form_validation');
$this->form_validation->set_rules(array(array('field' => 'publication_id', 'label' => 'Publication Name', 'rules' => 'required'), array('field' => 'issue_number', 'label' => 'Issue Number', 'rules' => 'required|is_numeric|callback_check_duplicate'), array('field' => 'issue_date_publication', 'label' => 'Publication Date', 'rules' => 'required|callback_date_validation')));
$this->form_validation->set_error_delimiters('<div class="alert alert-danger">', '</div>');
// checking selected file for cover
$check_file_upload = false;
if (isset($_FILES['issue_cover']['error']) && $_FILES['issue_cover']['error'] != 4) {
$check_file_upload = true;
}
if (!$this->form_validation->run() || $check_file_upload && !$this->upload->do_upload('issue_cover')) {
$this->load->view("magazine_add_form", array("publication_form_options" => $publication_form_options));
} else {
$this->load->model('Issue');
$issue = new Issue();
$issue->publication_id = $this->input->post('publication_id');
$issue->issue_number = $this->input->post('issue_number');
$issue->issue_date_publication = $this->input->post('issue_date_publication');
$upload_data = $this->upload->data();
if (isset($upload_data['file_name'])) {
$issue->issue_cover = $upload_data['file_name'];
}
$issue->save();
// making thumbnail of uploaded image for future use
$config['image_library'] = 'gd2';
$config['source_image'] = 'upload/' . $issue->issue_cover;
$config['create_thumb'] = true;
$config['maintain_ration'] = true;
$config['width'] = 75;
$config['height'] = 50;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
// the resulting thumbnail name is same as the cover name appended with '_thumb'
// success message after saving the new issue
$this->load->view('magazine_form_success', array('issue' => $issue));
}
$this->load->view('bootstrap/footer');
}
示例4: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Issue();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Issue'])) {
$model->attributes = $_POST['Issue'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id_trans));
}
}
$this->render('create', array('model' => $model));
}
示例5: index
/**
* Index page for Magazine controller.
*/
public function index()
{
$this->load->database();
$this->load->model('Publication');
$this->Publication->publication_name = 'Sandy Shore';
$this->Publication->save();
echo '<tt><pre>' . var_export($this->Publication, TRUE) . '</pre></tt>';
$this->load->model('Issue');
$issue = new Issue();
$issue->publication_id = $this->Publication->publication_id;
$issue->issue_number = 2;
$issue->issue_date_publication = date('2013-02-01');
$issue->issue_cover = 'This is first issue';
$issue->save();
echo '<tt><pre>' . var_export($issue, TRUE) . '</pre></tt>';
$this->load->view('magazines');
}
示例6: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate($id)
{
$equipment = $this->loadEquipment($id);
$model = new Issue();
$model->equipmentId = $id;
$model->status = 1;
$model->createTime = new CDbExpression('GETDATE()');
$model->userId = Yii::app()->user->id;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Issue'])) {
$model->attributes = $_POST['Issue'];
if ($model->save()) {
$this->redirect(array('result/create', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model, 'equipment' => $equipment));
}
示例7: actionAdd
public function actionAdd()
{
// Init
$data = $this->getJsonData();
// Store new element
$issue = new Issue();
$issue->setAttributes($data);
if (!$issue->save()) {
$errors = array();
foreach ($issue->getErrors() as $err) {
$errors[] = implode("\n", $err);
}
$this->sendError(implode("\n", $errors));
}
$issue = Issue::model()->with(array('status'))->findByPk($issue->id);
$item = array_merge($issue->attributes, array('status' => $issue->status->attributes));
// Success
$this->send($item);
}
示例8: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Issue();
$model->project_id = $this->_project->id;
//if _project property is not null, use it to set project for new issue
// if(!$this->_project===null)
// {
// $model->project_id = $this->_project->id;
// }
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Issue'])) {
$model->attributes = $_POST['Issue'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例9: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate($fk_componentDetail)
{
$model = new Issue();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Issue'])) {
$model->attributes = $_POST['Issue'];
$model->fk_componentDetail = $fk_componentDetail;
$passinfo = $fk_componentDetail;
if ($model->save()) {
//update component status
//call componentDetail model
$component = componentDetail::model()->findByPk($fk_componentDetail);
$component->deviceStatus = "In Use";
$component->save();
$this->redirect(array('componentDetail/admin'));
}
}
$this->render('create', array('model' => $model));
}
示例10: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
//
$rules = array('receivers_name' => 'required', 'quantity_issued' => 'required|integer', 'batch_no' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::route('issue.index')->withErrors($validator);
} else {
// store
$issue = new Issue();
$issue->receipt_id = Input::get('batch_no');
$issue->topup_request_id = Input::get('topup_request_id');
$issue->quantity_issued = Input::get('quantity_issued');
$issue->issued_to = Input::get('receivers_name');
$issue->user_id = Auth::user()->id;
$issue->remarks = Input::get('remarks');
try {
$issue->save();
return Redirect::route('issue.index')->with('message', trans('messages.commodity-succesfully-added'));
} catch (QueryException $e) {
Log::error($e);
}
}
}
示例11: store
public function store()
{
// Get StudentID
// From student_id or Create New
// Create Registration
// Create Issue
// Create Education
// Create Placement
// Create Receivables
// Reductions
// Create Installment
try {
//DB::beginTransaction();
if (Input::get('student_id') == 0) {
// Create New Student
$student = new Student();
$student->name = Input::get('name');
$student->sex = Input::get('sex');
$student->birthplace = Input::get('birthplace');
$student->birthdate = date('Y-m-d', strtotime(Input::get('birthdate')));
$student->religion = Input::get('religion');
$student->address = Input::get('address');
$student->contact = Input::get('contact');
$student->email = Input::get('email');
if (Input::get('sex') == 'L') {
$student->photo = 'boy.png';
} else {
$student->photo = 'girl.png';
}
$student->father_name = Input::get('father_name');
$student->father_occupation = Input::get('father_occupation');
$student->father_address = Input::get('father_address');
$student->father_contact = Input::get('father_contact');
$student->father_email = Input::get('father_email');
$student->mother_name = Input::get('mother_name');
$student->mother_occupation = Input::get('mother_occupation');
$student->mother_address = Input::get('mother_address');
$student->mother_contact = Input::get('mother_contact');
$student->mother_email = Input::get('mother_email');
$student->save();
$id = $student->id;
} else {
$student = Student::find(Input::get('student_id'));
$student->name = Input::get('name');
$student->sex = Input::get('sex');
$student->birthplace = Input::get('birthplace');
$student->birthdate = date('Y-m-d', strtotime(Input::get('birthdate')));
$student->religion = Input::get('religion');
$student->address = Input::get('address');
$student->contact = Input::get('contact');
$student->email = Input::get('email');
if (Input::get('sex') == 'L') {
$student->photo = 'boy.png';
} else {
$student->photo = 'girl.png';
}
$student->father_name = Input::get('father_name');
$student->father_occupation = Input::get('father_occupation');
$student->father_address = Input::get('father_address');
$student->father_contact = Input::get('father_contact');
$student->father_email = Input::get('father_email');
$student->mother_name = Input::get('mother_name');
$student->mother_occupation = Input::get('mother_occupation');
$student->mother_address = Input::get('mother_address');
$student->mother_contact = Input::get('mother_contact');
$student->mother_email = Input::get('mother_email');
$student->save();
$id = $student->id;
}
// Create Registration Data
$registration = new Registration();
$registration->project_id = Auth::user()->curr_project_id;
$registration->location_id = Auth::user()->location_id;
$registration->student_id = $id;
$registration->classification_id = Input::get('classification');
$registration->base_id = Input::get('location');
$registration->registration_date = date('Y-m-d', strtotime(Input::get('registration_date')));
$registration->registration_cost = Input::get('fee');
$registration->recommender_type = Input::get('recommender_type');
$registration->recommender_id = Input::get('recommender_id');
$registration->employee_id = Input::get('employee');
$registration->save();
// Create Issue
$issue = new Issue();
$issue->project_id = Auth::user()->curr_project_id;
$issue->location_id = Auth::user()->location_id;
$issue->registration_id = $registration->id;
$issue->generation_id = Input::get('generation');
$issue->student_id = $id;
$issue->issue = Input::get('issue');
$issue->save();
//Create Education Data
if (Input::get('school') != '0') {
$education = new Education();
$education->project_id = Auth::user()->curr_project_id;
$education->issue_id = $issue->id;
$education->school_id = Input::get('school');
$education->generation_id = Input::get('generation');
$education->save();
}
//.........这里部分代码省略.........
示例12: Issue
<?php
if (!empty($_POST['issueID'])) {
$issueID = $_POST['issueID'];
$issue = new Issue(new NamedArguments(array('primaryKey' => $issueID)));
$issue->resolutionText = $_POST['resolutionText'];
$issue->dateClosed = date("Y-m-d H:i:s");
try {
$issue->save();
} catch (Exception $e) {
echo $e->getMessage();
}
}
示例13: explode
if (!empty($_POST["ccEmails"])) {
$issueEmails = explode(',', $_POST["ccEmails"]);
}
$newIssue = new Issue();
$newIssue->creatorID = $user->loginID;
$newIssue->dateCreated = date('Y-m-d H:i:s');
if ($_POST["ccCreator"]) {
$issueEmails[] = $user->emailAddress;
}
if (!is_numeric($formDataArray["reminderInterval"])) {
$formDataArray["reminderInterval"] = 0;
}
foreach ($formDataArray as $key => $value) {
$newIssue->{$key} = $value;
}
$newIssue->save();
//start building the email body
$emailMessage = "Subject: {$newIssue->subjectText}\r\n\r\n\r\n\t\t\t\t\tBody: {$newIssue->bodyText}\r\n\r\n\r\n\t\t\t\t\tApplies To: ";
if ($organizationID) {
$newIssueRelationship = new IssueRelationship();
$newIssueRelationship->issueID = $newIssue->primaryKey;
$newIssueRelationship->entityID = $organizationID;
$newIssueRelationship->entityTypeID = 1;
$newIssueRelationship->save();
$emailMessage .= "{$organization->name}\r\n";
} else {
$orgResourcesArray = $sourceOrganization->getResources(5);
$orgResourcesIndexed = array();
foreach ($orgResources as $resource) {
$orgResourcesIndexed[$resource['resourceID']] = $resource;
}
示例14: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Issue();
$model->project_id = $this->_project->id;
if (!is_null($this->_issue)) {
$model->issue_id = $this->_issue->id;
}
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Issue'])) {
$model->attributes = $_POST['Issue'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model, 'project' => $this->_project, 'issue' => $this->_issue));
}
示例15: save_issue
private function save_issue()
{
$this->load->model('Issue');
$issue = new Issue();
$id = $this->input->post('issue_id');
if (!empty($id)) {
$issue->load($id);
}
$issue->issue_number = intval($this->input->post('issue_number'));
$issue->issue_date_publication = $this->input->post('issue_date_publication');
$issue->save();
return $issue;
}