Exemple #1
0
 public static function toBase($company_id = false)
 {
     if (isset($_POST['Contractor'])) {
         if (!$_POST['Contractor']['id']) {
             unset($_POST['Contractor']['id']);
         }
         if (!isset($_POST['Contractor']['company_id']) && $company_id) {
             $_POST['Contractor']['company_id'] = $company_id;
         }
         $arContractorCity = $_POST['Contractor']['city'];
         unset($_POST['Contractor']['city']);
         $contractor_id = SaveData::model('Contractor', $_POST['Contractor']);
         $logo_name = UploadFile::save('Contractor', $contractor_id, 'contractor-logo');
         $tContractor = Contractor::model()->findByPk($contractor_id);
         $tContractor->logo = $logo_name;
         $tContractor->update();
         /* сохраняем города */
         if ($arContractorCity) {
             foreach ($arContractorCity as $city_id) {
                 $arLink = array('city_id' => $city_id, 'contractor_id' => $contractor_id);
                 $link_id = SaveData::model('LinkCityContractor', $arLink);
             }
         }
         return $contractor_id;
     }
     return false;
 }
Exemple #2
0
 public static function toBase($company_id = false)
 {
     if (isset($_POST['Company'])) {
         $company_id = SaveData::model('Company', $_POST['Company']);
         return $company_id;
     }
     return false;
 }
Exemple #3
0
 public static function toBase($contractor_id = false)
 {
     if (isset($_POST['Comment'])) {
         if ($contractor_id) {
             $_POST['Comment']['contractor_id'] = $contractor_id;
         }
         $comment_id = SaveData::model('Comment', $_POST['Comment']);
         return $comment_id;
     }
     return false;
 }
Exemple #4
0
 public static function toBase($company_id = false)
 {
     if (isset($_POST['CompanyEmail'])) {
         if ($company_id) {
             foreach ($_POST['CompanyEmail'] as $email) {
                 $arPost = array('company_id' => $company_id, 'email' => $email);
                 $email_id = SaveData::model('CompanyEmail', $arPost);
             }
             return true;
         }
     }
     return false;
 }
Exemple #5
0
 public static function toBase($company_id = false)
 {
     if (isset($_POST['CompanyPhone'])) {
         if ($company_id) {
             foreach ($_POST['CompanyPhone'] as $phone) {
                 $arPost = array('company_id' => $company_id, 'phone' => $phone);
                 $phone_id = SaveData::model('CompanyPhone', $arPost);
             }
             return true;
         }
     }
     return false;
 }
Exemple #6
0
 public static function toBase($company_id = false)
 {
     if (isset($_POST['CompanyManager'])) {
         if ($company_id) {
             foreach ($_POST['CompanyManager']['name'] as $key => $name) {
                 $arPost = array('company_id' => $company_id, 'name' => $name, 'phone' => $_POST['CompanyManager']['phone'][$key], 'email' => $_POST['CompanyManager']['email'][$key]);
                 $manager_id = SaveData::model('CompanyManager', $arPost);
             }
             return true;
         }
     }
     return false;
 }
Exemple #7
0
 public static function toBase($contractor_id = false)
 {
     if (isset($_POST['Service'])) {
         if ($contractor_id) {
             $_POST['Service']['contractor_id'] = $contractor_id;
         }
         $service_id = SaveData::model('Service', $_POST['Service']);
         /* сохраняем картинки */
         $photo_names = UploadFile::saves('Service', $service_id, 'service-photo');
         foreach ($photo_names as $photo_name) {
             if ($photo_name) {
                 $tPhoto = new Photo();
                 $tPhoto->src = $photo_name;
                 $tPhoto->service_id = $service_id;
                 $tPhoto->save();
             }
         }
         return $service_id;
     }
     return false;
 }
Exemple #8
0
                    if ($tagPresent) {
                        $sql = "SELECT id FROM tags WHERE title LIKE '%" . $tag . "%'";
                        $rows = DataBase::fire($sql);
                        $tagId = current(current($rows));
                        ControlFunctions::forDebug($rows, "Ausgabe für Tag {$tag}, tag ID: ");
                        echo ControlFunctions::tagIt("h1", "{$tag} ID: {$tagId}");
                    } else {
                        // Paste Tag
                        $sql = "INSERT INTO tags (title, created, modified) VALUES (:title, :tstamp, :tstamp)";
                        $para = array('title' => $tag, 'tstamp' => $now);
                        DataBase::fire($sql, $para);
                        // Save ID
                        $tagId = DataBase::lastInsertId();
                    }
                    // Paste Relation
                    $sql = "INSERT INTO pois_tags (poi_id, tag_id) VALUES (:poi_id, :tag_id)";
                    $para = array('poi_id' => $lastPoisId, 'tag_id' => $tagId);
                    DataBase::fire($sql, $para);
                    echo ControlFunctions::tagIt("h1", "Letzter Eintrag: " . DataBase::lastInsertId());
                }
                DataBase::close();
            } catch (Exception $e) {
                die('Fehler bei .... Fehler: ' . $e->getMessage());
            }
        }
    }
}
$data = new googleData();
$app = new SaveData();
$db = new DataBase();
$app->dataTypes3Pages($data->phpQueryObj);
Exemple #9
0
 public static function toBase($service_id = false)
 {
     /************************************************************************************************/
     /* сохраняем транспорт */
     if (isset($_POST['ServTransport'])) {
         if ($service_id) {
             $_POST['ServTransport']['service_id'] = $service_id;
         }
         $transport_id = SaveData::model('ServTransport', $_POST['ServTransport']);
     }
     /* сохраняем транспорт - Количество часов подачи транспорта по городам */
     if (isset($_POST['ServTransportDeliv'])) {
         if ($transport_id) {
             foreach ($_POST['ServTransportDeliv']['hour'] as $key => $deliv) {
                 if ($_POST['ServTransportDeliv']['hour'][$key]) {
                     $arPost = array('hour' => $_POST['ServTransportDeliv']['hour'][$key], 'city_id' => $_POST['ServTransportDeliv']['city_id'][$key], 'serv_transport_id' => $transport_id);
                     $transport_deliv_id = SaveData::model('ServTransportDeliv', $arPost);
                 }
             }
         }
     }
     /* вносим изменения */
     if (isset($_POST['editServTransportDeliv'])) {
         foreach ($_POST['editServTransportDeliv'] as $arPost) {
             $transport_deliv_id = SaveData::model('ServTransportDeliv', $arPost);
         }
     }
     /* сохраняем транспорт - Дополнительные услуги  */
     if (isset($_POST['ServTransportExtra'])) {
         if ($transport_id) {
             foreach ($_POST['ServTransportExtra']['name'] as $key => $extra) {
                 if ($extra) {
                     $arPost = array('name' => $_POST['ServTransportExtra']['name'][$key], 'comment' => $_POST['ServTransportExtra']['comment'][$key], 'price_ss' => $_POST['ServTransportExtra']['price_ss'][$key], 'price_cell' => $_POST['ServTransportExtra']['price_cell'][$key], 'serv_transport_id' => $transport_id);
                     $transport_extra_id = SaveData::model('ServTransportExtra', $arPost);
                 }
             }
         }
     }
     /* вносим изменения */
     if (isset($_POST['editServTransportExtra'])) {
         foreach ($_POST['editServTransportExtra'] as $arPost) {
             $transport_extra_id = SaveData::model('ServTransportExtra', $arPost);
         }
     }
     /* сохраняем транспорт - Количество дополнительных часов для загородных поездок  */
     if (isset($_POST['ServTransportTrip'])) {
         if ($transport_id) {
             foreach ($_POST['ServTransportTrip']['hour'] as $key => $trip) {
                 if ($trip) {
                     $arPost = array('hour' => $_POST['ServTransportTrip']['hour'][$key], 'city_id_from' => $_POST['ServTransportTrip']['city_id_from'][$key], 'city_id_to' => $_POST['ServTransportTrip']['city_id_to'][$key], 'serv_transport_id' => $transport_id);
                     $transport_trip_id = SaveData::model('ServTransportTrip', $arPost);
                 }
             }
         }
     }
     /* вносим изменения */
     if (isset($_POST['editServTransportTrip'])) {
         foreach ($_POST['editServTransportTrip'] as $arPost) {
             $transport_extra_id = SaveData::model('ServTransportTrip', $arPost);
         }
     }
     /************************************************************************************************/
     return $transport_id;
 }