Example #1
0
 public function Sort()
 {
     $this->_DeliveryType = DELIVERY_TYPE_BOOL;
     $Success = FALSE;
     if ($this->Form->AuthenticatedPostBack()) {
         $TableID = GetPostValue('TableID', FALSE);
         if ($TableID) {
             $Rows = GetPostValue($TableID, FALSE);
             if (is_array($Rows)) {
                 try {
                     $Table = str_replace('Table', '', $TableID);
                     $TableModel = new Model($Table);
                     foreach ($Rows as $Sort => $ID) {
                         $TableModel->Update(array('Sort' => $Sort), array($Table . 'ID' => $ID));
                     }
                     $Success = TRUE;
                 } catch (Exception $ex) {
                     $this->Form->AddError($ex->getMessage());
                 }
             }
         }
     }
     if (!$Success) {
         $this->Form->AddError('ErrorBool');
     }
     $this->Render();
 }
Example #2
0
 /**
  * PDO::Update
  * @return Update
  */
 public static function pdoUpdate()
 {
     return self::$Update ? self::$Update : (self::$Update = new Update());
 }
Example #3
0
 public static function UpdateProduct($data, $id)
 {
     return parent::Update($data, 'products', 'id', $id);
 }
Example #4
0
 public static function UpdateCategory($data, $id)
 {
     return parent::Update($data, 'category', 'id', $id);
 }
Example #5
0
 if ($Model2Process->getID() && $ModelID && $Model2Process->getID() !== $ModelID) {
     continue;
 }
 $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];
Example #6
0
 public static function UpdateUser($data, $id)
 {
     return parent::Update($data, 'users', 'id', $id);
 }
Example #7
0
    $Model->setLastName(Utils::NullIfEmpty($_POST['txtLastName']));
    if ($_POST['txtBirthDate'] && $_POST['txtBirthDate'] != 'YYYY-MM-DD' && strtotime($_POST['txtBirthDate']) !== FALSE) {
        $Model->setBirthDate(strtotime($_POST['txtBirthDate']));
    } else {
        $Model->setBirthDate(-1);
    }
    $tags = Tag::GetTagArray($_POST['txtTags']);
    $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) {