public static function InsertProduct($data) { return parent::Insert($data, 'products', $indexFieldName); }
public function Picture($UserReference = '') { $this->Permission('Garden.SignIn.Allow'); $Session = Gdn::Session(); if (!$Session->IsValid()) { $this->Form->AddError('You must be authenticated in order to use this form.'); } $this->GetUserInfo($UserReference); $this->Form->SetModel($this->UserModel); $this->Form->AddHidden('UserID', $this->User->UserID); if ($this->Form->AuthenticatedPostBack() === TRUE) { $UploadImage = new Gdn_UploadImage(); try { // Validate the upload $TmpImage = $UploadImage->ValidateUpload('Picture'); // Generate the target image name $TargetImage = $UploadImage->GenerateTargetName(PATH_ROOT . DS . 'uploads'); $ImageBaseName = pathinfo($TargetImage, PATHINFO_BASENAME); // Save the uploaded image in large size $UploadImage->SaveImageAs($TmpImage, PATH_ROOT . DS . 'uploads' . DS . 'o' . $ImageBaseName, Gdn::Config('Garden.Picture.MaxHeight', 1000), Gdn::Config('Garden.Picture.MaxWidth', 1000)); // Save the uploaded image in profile size $UploadImage->SaveImageAs($TmpImage, PATH_ROOT . DS . 'uploads' . DS . 'p' . $ImageBaseName, Gdn::Config('Garden.Profile.MaxHeight', 1000), Gdn::Config('Garden.Profile.MaxWidth', 250)); // Save the uploaded image in preview size $UploadImage->SaveImageAs($TmpImage, PATH_ROOT . DS . 'uploads' . DS . 't' . $ImageBaseName, Gdn::Config('Garden.Preview.MaxHeight', 100), Gdn::Config('Garden.Preview.MaxWidth', 75)); // Save the uploaded image in thumbnail size $ThumbSize = Gdn::Config('Garden.Thumbnail.Size', 50); $UploadImage->SaveImageAs($TmpImage, PATH_ROOT . DS . 'uploads' . DS . 'n' . $ImageBaseName, $ThumbSize, $ThumbSize, TRUE); } catch (Exception $ex) { $this->Form->AddError($ex->getMessage()); } // If there were no errors, associate the image with the user if ($this->Form->ErrorCount() == 0) { $PhotoModel = new Model('Photo'); $PhotoID = $PhotoModel->Insert(array('Name' => $ImageBaseName)); if (!$this->UserModel->Save(array('UserID' => $this->User->UserID, 'PhotoID' => $PhotoID, 'Photo' => $ImageBaseName))) { $this->Form->SetValidationResults($this->UserModel->ValidationResults()); } } // If there were no problems, redirect back to the user account if ($this->Form->ErrorCount() == 0) { Redirect('garden/profile/' . $UserReference); } } $this->Render(); }
public static function InsertToFeedback($data) { return parent::Insert($data, 'feedback', $indexFieldName); }
public static function CreateCategory($data) { return parent::Insert($data, 'category'); }
} $Model2Process->setFirstName((string) $Model->attributes()->firstname); $Model2Process->setLastName((string) $Model->attributes()->lastname); $birthDate = strtotime((string) $Model->attributes()->birthdate); if ($birthDate !== FALSE) { $Model2Process->setBirthdate($birthDate); } else { $Model2Process->setBirthdate(-1); } if ($Model->Remarks) { $Model2Process->setRemarks($Model->Remarks); } if ($Model2Process->getID()) { Model::Update($Model2Process, $CurrentUser); } else { Model::Insert($Model2Process, $CurrentUser); } $modeltags = Tag::GetTagArray((string) $Model->attributes()->tags); $Tag2AllThisModel = Tag2All::Filter($Tag2AllsInDB, NULL, $Model2Process->getID(), FALSE, FALSE, FALSE); $Tag2AllThisModelOnly = Tag2All::Filter($Tag2AllThisModel, NULL, $Model2Process->getID(), NULL, NULL, NULL); Tag2All::HandleTags($modeltags, $Tag2AllThisModelOnly, $TagsInDB, $CurrentUser, $Model2Process->getID(), NULL, NULL, NULL, FALSE); if (!$Model->Sets) { continue; } $DatesThisModel = Date::FilterDates($DatesInDb, NULL, $Model2Process->getID(), NULL, NULL, NULL); foreach ($Model->Sets->Set as $Set) { $SetInDb = Set::Filter($SetsInDb, $Model2Process->getID(), NULL, preg_replace('/^SP_/i', '', (string) $Set->attributes()->name)); if ($SetInDb) { $SetInDb = $SetInDb[0]; } /* @var $Set2Process Set */
public static function InsertToOrders($data) { return parent::Insert($data, 'orders', $indexFieldName); }
public static function UserAdd($row) { return parent::Insert($row, 'users', 'id'); }
$Model->setRemarks(Utils::NullIfEmpty($_POST['txtRemarks'])); if ($Model->getID()) { if ($DeleteModel) { if ($CurrentUser->hasPermission(RIGHT_MODEL_DELETE) && Model::Delete($Model, $CurrentUser)) { header('location:index.php'); exit; } } else { if ($CurrentUser->hasPermission(RIGHT_MODEL_EDIT) && Model::Update($Model, $CurrentUser)) { Tag2All::HandleTags($tags, $TagsThisModel, $TagsInDB, $CurrentUser, $Model->getID(), NULL, NULL, NULL); header('location:index.php'); exit; } } } else { if ($CurrentUser->hasPermission(RIGHT_MODEL_ADD) && Model::Insert($Model, $CurrentUser)) { Tag2All::HandleTags($tags, $TagsThisModel, $TagsInDB, $CurrentUser, $Model->getID(), NULL, NULL, NULL); header('location:index.php'); exit; } } } echo HTMLstuff::HtmlHeader($Model->GetFullName(), $CurrentUser); if ($ModelID) { echo HTMLstuff::ImageLoading(sprintf('download_image.php?model_id=%1$d&width=400&height=600&portrait_only=true', $ModelID), 400, 600, htmlentities($Model->GetFullName()), htmlentities($Model->GetFullName())); echo '<div class="PhotoContainer Loading"></div>'; } ?> <h2><?php echo sprintf('<a href="index.php">%2$s</a> - %1$s', htmlentities($Model->GetFullName()), $lang->g('NavigationHome'));
public static function PageAdd($assocArr) { return parent::Insert($assocArr, 'pages', 'page_id'); }