public function __construct($array, $timezone = null)
 {
     $this->title = $array['title'];
     if (isset($array['allDay'])) {
         // allDay has been explicitly specified
         $this->allDay = (bool) $array['allDay'];
     } else {
         // Guess allDay based off of ISO8601 date strings
         $this->allDay = preg_match(self::ALL_DAY_REGEX, $array['start']) && (!isset($array['end']) || preg_match(self::ALL_DAY_REGEX, $array['end']));
     }
     if ($this->allDay) {
         // If dates are allDay, we want to parse them in UTC to avoid DST issues.
         $timezone = null;
     }
     // Parse dates
     $this->start = parseDateTime($array['start'], $timezone);
     $this->end = isset($array['end']) ? parseDateTime($array['end'], $timezone) : null;
     // Record misc properties
     /*foreach ($array as $name => $value) {
     			if (!in_array($name, array('title', 'allDay', 'start', 'end'))) {
     				$this->properties[$name] = $value;
     			}
     		}*/
     $this->id = $array['id'];
     $this->detalls = $array['detalls'];
     $this->parcela = $array['parcela'];
     $this->realitzada = (bool) $array['realitzada'];
 }
Exemple #2
0
 public function fromRequest($array)
 {
     // transfore donnees Js en Pimcore
     if (isset($array['dateRegister'])) {
         $array['dateRegister'] = parseDateTime($array['dateRegister']);
     }
     return $array();
 }
 public function acquire()
 {
     if ($this->items == null) {
         $result = mysql_query("SELECT `When` FROM lastchanges WHERE Section='{$this->section}'");
         $row = mysql_fetch_row($result);
         if ($row == false) {
             throw new Exception("Chyba při získávání datumu poslední změny - sekce: {$this->section}");
         }
     } else {
         $item = $this->items[0];
         $result = mysql_query("SELECT `When` FROM lastchanges WHERE Section='{$this->section}' AND Item={$item}");
         if (!($row = mysql_fetch_row($result))) {
             $row = array("2000-01-01 00:00:00");
         }
     }
     $dt = parseDateTime($row[0]);
     $this->timestamp = $dt['stamp'];
 }
Exemple #4
0
 function getEventsForHome()
 {
     $this->load->file('php/utils.php', false);
     $all_shows = array();
     $range_start = parseDateTime($_GET['start']);
     $range_end = parseDateTime($_GET['end']);
     if ($this->session->userdata('logged_in')) {
         $session_data = $this->session->userdata('logged_in');
         $usershows = $this->shows_model->get_user_shows($session_data['id']);
         foreach ($usershows as $show) {
             $showArray = array();
             $url = 'http://services.tvrage.com/feeds/episode_list.php?sid=' . $show;
             //				$url = 'xmls/' . $show . '.xml';
             $feed = file_get_contents($url);
             $xml = simplexml_load_string($feed) or die("Error: Cannot create object");
             $show_name = strval($xml->name);
             $dom = new DOMDocument();
             $dom->loadXML($feed);
             $episodes = $xml->xpath('//episode');
             foreach ($episodes as $episode) {
                 if (count($episode->xpath("parent::*/@no")) > 0) {
                     $season = (string) $episode->xpath("parent::*/@no")[0]->no;
                     $episodenr = (string) $episode->seasonnum;
                     array_push($showArray, array('title' => $show_name, 'start' => $episode->airdate, 'season' => $season, 'episodenr' => $episodenr));
                 }
             }
             foreach ($showArray as $array) {
                 // Convert the input array into a useful Event object
                 $event = new Event($array, null);
                 if ($event->isWithinDayRange($range_start, $range_end)) {
                     $all_shows[] = $event->toArray();
                 }
             }
         }
         echo json_encode($all_shows);
     } else {
         //If no session, redirect to login page
         redirect('login', 'refresh');
     }
 }
Exemple #5
0
 public function feed()
 {
     //require file
     require FCPATH . 'assets/js/fullcalendar/demos/php/utils.php';
     //variable
     $range_start;
     $range_end;
     $timezone = null;
     $output_arrays = array();
     // Short-circuit if the client did not give us a date range.
     if (!isset($_POST['start']) || !isset($_POST['end'])) {
         die("Please provide a date range.");
     }
     // Parse the start/end parameters.
     // These are assumed to be ISO8601 strings with no time nor timezone, like "2013-12-29".
     // Since no timezone will be present, they will parsed as UTC.
     $range_start = $_POST['start'];
     $range_end = $_POST['end'];
     // Parse the timezone parameter if it is present.
     if (isset($_GET['timezone'])) {
         $timezone = new DateTimeZone($_GET['timezone']);
     }
     // Read and parse our events JSON file into an array of event data arrays.
     $query = $this->holiday->getListForCalendar($range_start, $range_end);
     if ($query->num_rows() > 0) {
         foreach ($query->result_array() as $row) {
             $data = array();
             $data["title"] = $row["HName"];
             $data["allDay"] = true;
             $data["start"] = $row["HDate"];
             $data["end"] = $row["HDate"];
             $event = new Event($data, $timezone);
             if ($event->isWithinDayRange(parseDateTime($range_start), parseDateTime($range_end))) {
                 $output_arrays[] = $event->toArray();
             }
         }
     }
     // Send JSON to the client.
     echo json_encode($output_arrays);
 }
function get_free_time_events()
{
    // Require our Event class and datetime utilities
    require plugin_dir_path(__FILE__) . '/php/utils.php';
    $IDU_Type = $_GET['IDU_Type'];
    $IDU = $_GET['IDU'];
    //Salesforce connection setup
    $server_base = $_SERVER['DOCUMENT_ROOT'];
    define("SOAP_CLIENT_BASEDIR", "{$server_base}/wp-content/Force.com-Toolkit-for-PHP-master/soapclient");
    require_once SOAP_CLIENT_BASEDIR . '/SforceEnterpriseClient.php';
    require_once "{$server_base}/wp-content/Force.com-Toolkit-for-PHP-master/samples/userAuth.php";
    ini_set("soap.wsdl_cache_enabled", "0");
    $mySforceConnection = new SforceEnterpriseClient();
    $mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR . '/enterprise.wsdl.xml');
    $mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);
    //Salesforce Query
    $query = "SELECT Id,Free_Json_Times__c,Firstname,Lastname,C_ID__c From Contact  WHERE  Id='{$IDU}'";
    //Salesforce Response
    $response = $mySforceConnection->query($query);
    //exit if nothing returned
    if (count($response->records) == 0) {
        exit;
    }
    foreach ($response->records as $record) {
        $status = $record->Status__c;
        $Leading_Type = $record->Leading_Type__c;
        $json_free_time = $record->Free_Json_Times__c;
    }
    // die( $selected_time);
    // die($json);
    // Short-circuit if the client did not give us a date range.
    if (!isset($_GET['start']) || !isset($_GET['end'])) {
        die("Please provide a date range.");
    }
    // Parse the start/end parameters.
    // These are assumed to be ISO8601 strings with no time nor timezone, like "2013-12-29".
    // Since no timezone will be present, they will parsed as UTC.
    $range_start = parseDateTime($_GET['start']);
    $range_end = parseDateTime($_GET['end']);
    // Parse the timezone parameter if it is present.
    $timezone = null;
    if (isset($_GET['timezone']) && $_GET['timezone'] != 'local') {
        $timezone = new DateTimeZone($_GET['timezone']);
    }
    // if (isset($_GET['timezone'])) {
    //     $timezone = new DateTimeZone($_GET['timezone']);
    // }
    // Read and parse our events JSON file into an array of event data arrays.
    $input_arrays = json_decode($json_free_time, true);
    // die($selected_time);
    // Accumulate an output array of event data arrays.
    $output_arrays = array();
    if (count($input_arrays) > 0) {
        foreach ($input_arrays as $array) {
            //     // Convert the input array into a useful Event object
            $event = new Event($array, $timezone);
            // If the event is in-bounds, add it to the output
            if ($event->isWithinDayRange($range_start, $range_end)) {
                $output_arrays[] = $event->toArray();
            }
        }
    }
    // Send JSON to the client.
    die(json_encode($output_arrays));
}
    public function _getHTML()
    {
        $this->loadData();
        $o_id = sprintf("%03d", $this->data->YID) . "–{$this->data->Year}";
        $dt = parseDateTime($this->data->Created);
        $created = date('j.n.Y', $dt['stamp']);
        $html = <<<EOT
<table class="faktura" cellspacing="1" cellpadding="1">
\t<tr class="adresa1">
\t\t<td class="adresa1L"></td>
\t\t<td class="adresa1P">
\t\t\t<span>Bestellung Nr.: </span>{$o_id}<br />
\t\t\t<span>Bestelldatum: </span>{$created}
\t\t</td>
\t</tr>
\t<tr class="adresa2">
\t\t<td class="adresa2L">
\t\t\t<h3 class="adresa2Lh3">Lieferadresse:</h3>{$this->renderDeliveryAddress()}
\t\t</td>
\t\t<td class="adresa2P">
\t\t\t<h3 class="adresa2Lh3">Rechnungsadresse:</h3>{$this->renderInvoiceAddress()}
\t\t</td>
\t</tr>
\t<tr>
\t\t<td>
\t\t</td>
\t\t<td class="objinfo">
\t\t\t<strong>Zürich, {$created}</strong>
\t\t</td>
\t</tr>
\t<tr>
\t\t<td colspan="2" class="objinfo1">
\t\t\t<strong>Rechnung Nr. {$o_id}</strong>
\t\t</td>
\t</tr>
\t<tr>
\t\t<td colspan="2">
\t\t\t<table>
               \t<tr class="polozkynadpis">
\t\t\t\t\t<td class="nfks">Stk.</td>
\t\t\t\t\t<td class="nfnm">Artikelbezeichnung</td>
\t\t\t\t\t<td class="nfcn">Preis pro Stk.</td>
\t\t\t\t\t<td class="nfck">Gesamt CHF</td>
\t\t\t\t</tr>

EOT;
        $sw = 1;
        $next_sw = array(1 => 2, 2 => 1);
        $flds = array('Title', 'Code', 'Amount', 'Cost');
        $i = 1;
        foreach ($this->ordrows as $ordrow) {
            $fval = array();
            foreach ($flds as $fld) {
                $fval[$fld] = htmlspecialchars($ordrow['rowdata']->{$fld});
            }
            $fval['CostTotal'] = htmlspecialchars($ordrow['rowdata']->Cost * $ordrow['rowdata']->Amount);
            $props_a = array();
            foreach ($ordrow['properties'] as $property) {
                $props_a[] = htmlspecialchars($property['name']) . ': ' . htmlspecialchars($property['value']);
            }
            $fval['Properties'] = empty($props_a) ? '' : ', ' . implode(', ', $props_a);
            $cost1_f = $this->formatCost($fval['Cost'], 'CHF');
            $costT_f = $this->formatCost($fval['CostTotal'], 'CHF');
            $html .= <<<EOT
\t\t\t\t<tr class="polozky">
\t\t\t\t\t<td class="fks">{$fval['Amount']}</td>
\t\t\t\t\t<td class="fnm">
\t\t\t\t\t\t<strong>{$fval['Title']}</strong><br />
\t\t\t\t\t\tArt.Nr. {$fval['Code']}{$fval['Properties']}
\t\t\t\t\t</td>
\t\t\t\t\t<td class="fcn">{$cost1_f}</td>
\t\t\t\t\t<td class="fck"><strong>{$costT_f}</strong></td>
\t\t\t\t</tr>

EOT;
            $i++;
            $sw = $next_sw[$sw];
        }
        $html .= <<<EOT
\t\t\t</table>
\t\t</td>
\t</tr>

EOT;
        $delivery_specs = array('CHP' => 'per Post', 'DPD' => 'DPD', 'PSA' => 'Persönliche Sammlung');
        $delivery = array_key_exists($this->data->Delivery, $delivery_specs) ? $delivery_specs[$this->data->Delivery] : $this->data->Delivery;
        //if ($dcost = $this->data->DeliveryCost) $delivery .= " ({$this->formatCost($dcost, 'CHF')})";
        $dcost = $this->data->DeliveryCost;
        // způsob platby je spojen s doručením
        $payment_specs = array('VPB' => 'Vorauskasse per Banküberweisung', 'PNN' => 'auf Rechnung', 'BAR' => 'Barzahlung');
        $payment = array_key_exists($this->data->Payment, $payment_specs) ? $payment_specs[$this->data->Payment] : $this->data->Payment;
        //if ($pcost = $this->data->PaymentCost) $payment .= " ({$this->formatCost($pcost, 'CHF')})";
        $pcost = $this->data->PaymentCost;
        $productscost = $this->data->ProductsTotalCost;
        $products_and_delivery_cost = $productscost + $dcost;
        $products_and_delivery_cost_f = $this->formatCost($products_and_delivery_cost);
        if ($this->data->Payment === 'VPB' || $this->data->Payment === 'BAR') {
            $paymentcost_str = <<<EOT
{$payment} Skonto 3% von {$products_and_delivery_cost_f} CHF
EOT;
        } else {
            $paymentcost_str = $payment;
        }
        $totalcost = $this->roundCost($productscost + $dcost + $pcost);
        $productscost_f = $this->formatCost($productscost, 'CHF');
        $totalcost_f = $this->formatCost($totalcost, 'CHF');
        //$note = str_replace("\r\n", "\r", htmlspecialchars($this->data->Note));
        //$packagecode = htmlspecialchars($this->data->PackageCode);
        //$astate = array(0 => '', 1 => '', 2 => '', 3 => '', 4 => '', 5 => '');
        //$astate[$this->data->Status] = ' checked';
        $html .= <<<EOT
\t<tr class="infodoprava">
\t\t<td colspan="2">
\t\t\t<strong>Lieferung: </strong>{$delivery}
\t\t</td>
\t</tr>
\t<tr class="infoplatba">
\t\t<td colspan="2">
\t\t\t<strong>Zahlungsart: </strong>{$payment}
\t\t</td>
\t</tr>
</table>
<table class="faktura">
\t<tr>
\t\t<td class="hodnota">Warenwert: </td>
\t\t<td class="hodnota-cena">{$productscost_f}</td>
\t</tr>

EOT;
        if ($dcost) {
            $deliverycost_f = $this->formatCost($dcost);
            $html .= <<<EOT
\t<tr>
\t\t<td class="doprava">Versandkosten: </td>
\t\t<td class="doprava-cena">{$deliverycost_f} CHF</td>
\t</tr>

EOT;
        }
        $MwSt = $this->formatCost($products_and_delivery_cost * 0.08);
        $html .= <<<EOT
\t\t<!--<tr>
\t\t\t<td class="dph">MwSt 8% von {$products_and_delivery_cost_f} CHF: </td>
\t\t\t<td colspan="2" class="dph-cena">{$MwSt} CHF</td>
\t\t</tr>-->

EOT;
        if ($pcost) {
            $paymentcost_f = $this->formatCost($pcost);
            $html .= <<<EOT
\t<tr>
\t\t<td class="sleva">{$paymentcost_str}:</td>
\t\t<td class="sleva-cena">{$paymentcost_f} CHF</td>
\t</tr>

EOT;
        }
        $html .= <<<EOT
\t<tr>
\t\t<td class="celkem">Gesamtsumme (CHF):</td>
\t\t<td class="celkem-cena">{$totalcost_f}</td>
\t</tr>
\t<tr>
\t\t<td colspan="2" class="celkem">Inkl. MwSt. 8% und Versand- Servicekosten</td>
\t</tr>
</table>
<table class="faktura">
\t<tr class="platba-info">
\t\t<td><strong>Bitte zahlen Sie innert  10 Tagen auf unser Konto:</strong> 40-630173-3</td>
\t</tr>
\t<tr class="platba-info">
\t\t<td><strong>Besten Dank für Ihren geschätzten Auftrag. Wir verbleiben mit freundlichen Grüssen und höflicher Empfehlung</strong></td>
\t</tr>
</table>
EOT;
        return $html;
    }
 protected function loadData()
 {
     if ($this->data === null && $this->id) {
         $result = mysql_query("SELECT ID, Title, Code, ShortDesc, URL, PageTitle, LongDesc, Collection, OriginalCost, NewCost, WSCost, Photo, Discount, Sellout, Action, Novelty, Exposed, Active, LastChange FROM products WHERE ID={$this->id}");
         if ($row = mysql_fetch_array($result)) {
             $this->data = new Kiwi_DataRow($row);
             $this->title = $this->data->Title;
             $this->code = $this->data->Code;
             $this->auto = $this->data->URL == '';
             $this->url = $this->data->URL;
             $this->htitle = $this->data->PageTitle;
             $this->shortdesc = $this->data->ShortDesc;
             $this->longdesc = $this->data->LongDesc;
             $this->collection = $this->data->Collection;
             $this->original_cost = $this->data->OriginalCost;
             $this->new_cost = $this->data->NewCost;
             $this->ws_cost = $this->data->WSCost;
             $this->photo = $this->data->Photo;
             $this->novelty = $this->data->Novelty;
             $this->action = $this->data->Action;
             $this->discount = $this->data->Discount;
             $this->sellout = $this->data->Sellout;
             $this->exposed = $this->data->Exposed;
             $this->active = $this->data->Active;
             $dt = parseDateTime($this->data->LastChange);
             $this->lastchange = date('j.n.Y H:i', $dt['stamp']);
             $result = mysql_query("SELECT ID, FileName FROM prodepics WHERE PID={$this->id} ORDER BY ID");
             while ($row = mysql_fetch_array($result)) {
                 $this->photo_extra[$row['ID']] = array('FileName' => $row['FileName']);
             }
             $result = mysql_query("SELECT ID, FileName FROM prodipics WHERE PID={$this->id} ORDER BY ID");
             while ($row = mysql_fetch_array($result)) {
                 $this->photo_illustrative[$row['ID']] = array('FileName' => $row['FileName']);
             }
             $code = mysql_real_escape_string($this->code);
             $result = mysql_query("SELECT Count(*) FROM products WHERE Code='{$code}'");
             if ($row = mysql_fetch_row($result)) {
                 $this->code_unique = $row[0] < 2;
             } else {
                 throw new Exception("Chyba při ověřování unikátnosti kódu produktu");
             }
             $this->loadGroup();
         } else {
             throw new Exception("Neplatný identifikátor produktu");
         }
     }
 }
Exemple #9
0
 /**
  */
 function checkCancelTime()
 {
     return true;
     $now = time();
     $OrderDateEndHOSE = date('Y-m-d') . " " . changeMinute(SESSION_3_END, "+5") . ":30";
     $arrOrderDateEndHOSE = parseDateTime($OrderDateEndHOSE);
     $unixOrderDateEndHOSE = mktime($arrOrderDateEndHOSE[3], $arrOrderDateEndHOSE[4], $arrOrderDateEndHOSE[5], $arrOrderDateEndHOSE[1], $arrOrderDateEndHOSE[2], $arrOrderDateEndHOSE[0]);
     $EndWorkingTime = date('Y-m-d') . " 17:00:00";
     $arrEndWorkingTime = parseDateTime($EndWorkingTime);
     $unixEndWorkingTime = mktime($arrEndWorkingTime[3], $arrEndWorkingTime[4], $arrEndWorkingTime[5], $arrEndWorkingTime[1], $arrEndWorkingTime[2], $arrEndWorkingTime[0]);
     if ($unixOrderDateEndHOSE < $now && $now < $unixEndWorkingTime) {
         return true;
     } else {
         return false;
     }
 }
    public function _getHTML()
    {
        $this->loadLastChange();
        $this->loadClients();
        $self = basename($_SERVER['PHP_SELF']);
        $html = <<<EOT
<form action="{$self}" method="post">
\t<h2>Katalog Klienten - [Liste]</h2>
\t<div class="levyV">

EOT;
        if ($this->lastchange != null) {
            $html .= <<<EOT
\t\t<div class="zmena">Zuletzt Aktualisiert: {$this->lastchange->format()}</div>

EOT;
        }
        $tabs_html = '';
        $tqs = $this->consQS(true);
        $tqs .= $tqs == '' ? '?' : '&';
        foreach ($this->fletters as $fletter => $flcount) {
            $fletterqs = urlencode($fletter);
            if ($this->letter == $fletter) {
                $tabs_html .= <<<EOT

\t\t\t<span>{$fletter}</span>
EOT;
            } elseif ($flcount == 0) {
                $tabs_html .= <<<EOT

\t\t\t<b>{$fletter}</b>
EOT;
            } else {
                $tabs_html .= <<<EOT

\t\t\t<a href="{$self}{$tqs}l={$fletterqs}">{$fletter}</a>
EOT;
            }
        }
        $html .= <<<EOT
\t\t<div id="zalozky">{$tabs_html}

EOT;
        if ($this->letter === null) {
            $html .= <<<EOT
\t\t\t<span>Alles</span>

EOT;
        } else {
            $html .= <<<EOT
\t\t\t<a href="{$self}{$tqs}l=all">Alles</a>

EOT;
        }
        $search = htmlspecialchars($this->getSearchBoxText());
        $html .= <<<EOT
\t\t<div class="searchbox">
\t\t\t<input type="text" id="kclfc_sbox" name="search" value="{$search}" class="searchinp" />
\t\t\t<input type="submit" id="kclfc_sbtn" name="cmd" value="suchen" class="searchbtn" />
\t\t</div>
\t\t<br class="clear" />
\t\t</div>

EOT;
        $disabled_str = sizeof($this->clients) == 0 ? ' disabled' : '';
        $all_checked_str = $this->all_checked ? ' checked' : '';
        $html .= <<<EOT
\t\t<div id="frame">
\t\t\t<table class="tab-seznam" cellspacing="0" cellpadding="0">
\t\t\t\t<tr>
\t\t\t\t\t<th><input type="checkbox" name="checkall" value="Vsechny"{$disabled_str} onclick="checkUncheckAll(document.getElementsByName('check[]'),this);Kiwi_Clients_Form.enableBtns(false);"{$all_checked_str} /></th>
\t\t\t\t\t<th>Name</th>
\t\t\t\t\t<th>Email</th>
\t\t\t\t\t<th></th>
\t\t\t\t\t<th>geändert</th>
\t\t\t\t\t<th>erstellt</th>
\t\t\t\t</tr>

EOT;
        $sw = 1;
        $next_sw = array(1 => 2, 2 => 1);
        foreach ($this->clients as $client) {
            if ($this->letter !== null) {
                $clientname = $client->BusinessName ? $client->BusinessName : $client->SurName;
                $ltr = mb_strtoupper(mb_substr($clientname, 0, 2));
                if ($ltr != 'CH') {
                    $ltr = $this->removeDiaT1(mb_substr($ltr, 0, 1));
                }
                if ($ltr != $this->letter) {
                    continue;
                }
            }
            $checked_str = isset($this->checked[$client->ID]) && $this->checked[$client->ID] ? ' checked' : '';
            $clink = KIWI_EDIT_CLIENT . "?c={$client->ID}";
            $mlink = KIWI_ESHOPMAIL_FORM . "?c={$client->ID}";
            if ($client->BusinessName) {
                $name = htmlspecialchars($client->BusinessName);
                $email = htmlspecialchars($client->FirmEmail);
                $clientstatus_icon = 'clientF';
                $clientstatus_text = 'Firma';
            } else {
                $name = htmlspecialchars(($client->Title ? "{$client->Title} " : '') . "{$client->FirstName} {$client->SurName}");
                $email = htmlspecialchars($client->Email);
                $clientstatus_icon = 'clientP';
                $clientstatus_text = 'Privatperson';
            }
            $clientstatus_str = <<<EOT
<img src="./image/{$clientstatus_icon}.gif" alt="" title="{$clientstatus_text}" />
EOT;
            $dt = parseDateTime($client->LastChange);
            $lastchange = date('j.n.Y H:i', $dt['stamp']);
            $dt = parseDateTime($client->Created);
            $created = date('j.n.Y H:i', $dt['stamp']);
            $html .= <<<EOT
\t\t\t\t<tr class="t-s-{$sw}">
\t\t\t\t\t<td><input type="checkbox" name="check[]" value="{$client->ID}" onclick="Kiwi_Clients_Form.enableBtns(this.checked)"{$checked_str} /></td>
\t\t\t\t\t<td><a href="{$clink}">{$name}</a></td>
\t\t\t\t\t<td><a href="{$mlink}">{$email}</a></td>
\t\t\t\t\t<td>{$clientstatus_str}</td>
\t\t\t\t\t<td>{$lastchange}</td>
\t\t\t\t\t<td>{$created}</td>
\t\t\t\t</tr>

EOT;
            $sw = $next_sw[$sw];
        }
        if (sizeof($this->checked) == 0) {
            $disabled_str = ' disabled';
            $but_class = 'but3D';
        } else {
            $disabled_str = '';
            $but_class = 'but3';
        }
        $html .= <<<EOT
\t\t\t</table>
\t\t</div>
\t</div>
\t<div class="form2">
\t\t<fieldset>

EOT;
        $html .= <<<EOT
\t\t\t<input type="submit" id="kclfc_cmd1" name="cmd" value="entfernen" class="{$but_class}"{$disabled_str} onclick="return Kiwi_Clients_Form.onDelete()" />
\t\t</fieldset>
\t</div>
</form>

EOT;
        return $html;
    }
 protected function loadData()
 {
     if ($this->data == null && $this->id) {
         $result = mysql_query("SELECT M.ID, X.NGID, M.Name, X.Count, X.ListMode, X.ShowPages, X.DetailLink, M.LastChange FROM modules AS M LEFT OUTER JOIN mod_news AS X ON M.ID=X.ID WHERE M.ID={$this->id}");
         if ($row = mysql_fetch_assoc($result)) {
             $this->data = new Kiwi_DataRow($row);
             $this->name = $this->data->Name;
             $this->perpage = (int) $this->data->Count;
             $this->ngid = $this->data->NGID;
             $this->listmode = $this->data->ListMode;
             $this->showpages = $this->data->ShowPages != 0;
             $this->detaillink = $this->data->DetailLink;
             $dt = parseDateTime($this->data->LastChange);
             $this->lastchange = date('j.n.Y H:i', $dt['stamp']);
         } else {
             throw new Exception("Neplatný identifikátor modulu");
         }
     }
     if (!is_array($this->newsgroups)) {
         $this->newsgroups = array();
         $result = mysql_query("SELECT ID, Title FROM newsgroups ORDER BY Title");
         while ($row = mysql_fetch_array($result)) {
             $this->newsgroups[] = new Kiwi_DataRow($row);
         }
     }
 }
    public function _getHTML()
    {
        global $kiwi_config;
        $oFCKeditor_content = new FCKeditor('knlrfc_content');
        $oFCKeditor_content->Config['CustomConfigurationsPath'] = KIWI_DIRECTORY . 'fckcustom/fckconfig.js';
        $oFCKeditor_content->Config['StylesXmlPath'] = KIWI_DIRECTORY . 'fckcustom/fckstyles.xml';
        $oFCKeditor_content->Config['ToolbarStartExpanded'] = false;
        // $oFCKeditor_content->BasePath = FCK_EDITOR_DIR; // defaultní hodnota
        $oFCKeditor_content->Width = 720;
        $oFCKeditor_content->Height = 296;
        // $oFCKeditor_content->ToolbarSet = 'Kiwi';
        $oFCKeditor_content->ToolbarSet = 'Default';
        if ($this->id) {
            $this->loadData();
            $tname = htmlspecialchars($this->title);
            $dt = parseDateTime($this->data->LastChange);
            $lastchange = date('j.n. Y - H:i', $dt['stamp']);
        } else {
            $tname = 'neu';
            $lastchange = null;
        }
        if ($this->read_only) {
            $ro_disabled_str = ' disabled';
            $D_str = 'D';
        } else {
            $ro_disabled_str = $D_str = '';
        }
        $self = basename($_SERVER['PHP_SELF']);
        $qs = $this->consQS();
        $title = htmlspecialchars($this->title);
        $active_checked_str = $this->active ? ' checked' : '';
        $oFCKeditor_content->Value = $this->content;
        if ($this->title != '') {
            $tname = $title;
        } else {
            $tname = 'Neu';
        }
        $html = <<<EOT
<form action="{$self}{$qs}" method="post">
\t<h2>Newsletter - {$tname} - [editieren]</h2>
\t<div class="levyV">
 \t\t<div class="form3">
\t\t\t<fieldset id="knlrfc_fs">

EOT;
        if ($lastchange !== null) {
            $html .= <<<EOT
\t\t\t\t<div class="zmena">Zuletzt Aktualisiert: {$lastchange}</div>

EOT;
        }
        if ($this->read_only) {
            $readonly_str = ' readonly';
            $readonly_str2 = ' disabled';
            $readonly_str3 = 'D';
            $onchange_str = '';
            $onchange_str2 = '';
        } else {
            $readonly_str = '';
            $readonly_str2 = '';
            $readonly_str3 = '';
            $onchange_str = ' onchange="Kiwi_Newsletter_Form.onChange()" onkeydown="Kiwi_Newsletter_Form.onKeyDown(event)"';
            $onchange_str2 = $onchange_str . ' onclick="Kiwi_Newsletter_Form.onChange()"';
        }
        $start = htmlspecialchars($this->start);
        $html .= <<<EOT
\t\t\t\t<div id="frame">
\t\t\t\t\t<table class="tab-form" cellspacing="0" cellpadding="0">
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td><span class="span-form2">Newsletter-Name&nbsp;:</span></td>
\t\t\t\t\t\t\t<td><input type="text" id="knlrfc_title" name="Nazev" value="{$title}" class="inpOUT" onfocus="this.className='inpON'" onblur="this.className='inpOUT'"{$onchange_str}{$readonly_str} /></td>
\t\t\t\t\t\t</tr>
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td><span class="span-form2">Start :</span></td>
\t\t\t\t\t\t\t<td><input type="text" id="knlrfc_start" name="Start" value="{$start}" class="inpOUT" onfocus="this.className='inpON'" onblur="this.className='inpOFF'"{$onchange_str}{$readonly_str} /></td>
\t\t\t\t\t\t</tr>
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td></td>
\t\t\t\t\t\t\t<td colspan="2"><input type="checkbox" id="knlrfc_active" name="Aktivni"{$active_checked_str}{$onchange_str2}{$readonly_str2} /> aktiv</td>
\t\t\t\t\t\t</tr>

EOT;
        //TODO: reflect readonly
        $content_html = $oFCKeditor_content->CreateHtml();
        $html .= <<<EOT
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td><span class="span-form2">Content :</span></td>
\t\t\t\t\t\t\t<td>{$content_html}</td>
\t\t\t\t\t\t</tr>

EOT;
        $onback_js_arg = $this->redirectLevelUpLink();
        if ($this->id) {
            $preview = KIWI_NEWSLETTER_PREVIEW . '?nl=' . $this->id;
            $previewHtml = <<<EOT

\t\t\t\t<div class="newsletter-preview"><a href="{$preview}" title="" target="_blank">Preview</a></div>
EOT;
        } else {
            $previewHtml = '';
        }
        $html .= <<<EOT
\t\t\t\t\t</table>
\t\t\t\t</div>
\t\t\t\t<input type="submit" id="knlrfc_cmd1" name="cmd" value="speichern" class="but3{$readonly_str3}" onclick="return Kiwi_Newsletter_Form.onSave()"{$readonly_str2} />
\t\t\t\t<input type="button" id="knlrfc_cmd4" name="cmd" value="Zurück" class="but3" onclick="return Kiwi_Newsletter_Form.onBack('{$onback_js_arg}')" />{$previewHtml}
\t\t\t</fieldset>
\t\t</div>
\t</div>

EOT;
        if ($this->id && $this->productsEnabled()) {
            $this->loadLastChange();
            $this->loadProducts();
            $disabled_str = count($this->products) == 0 || $this->read_only ? ' disabled' : '';
            $all_checked_str = $this->all_checked ? ' checked' : '';
            $html .= <<<EOT
\t<h2>[Posten] - {$tname} - [verbunden Artikel]</h2>
\t<div class="levyV">
\t\t<div class="zmena">Zuletzt Aktualisiert: {$this->lastchange->format()}</div>
\t\t<div id="frame">
\t\t\t<table class="tab-seznam" cellspacing="0" cellpadding="0">
\t\t\t\t<tr>
\t\t\t\t\t<th><input type="checkbox" name="checkall" value="Vsechny"{$disabled_str} onclick="checkUncheckAll(document.getElementsByName('check[]'),this);Kiwi_Newsletter_Form.enableBtns(false);"{$all_checked_str} /></th>
\t\t\t\t\t<th>Artikel-Name</th>
\t\t\t\t\t<th>Preis</th>
\t\t\t\t\t<th><span title="Neu">N</span></th>
\t\t\t\t\t<th><span title="Aktion">Ak</span></th>
\t\t\t\t\t<th><span title="Rabatt">R</span></th>
\t\t\t\t\t<th><span title="Ausferkauf">Au</span></th>
\t\t\t\t\t<th></th>
\t\t\t\t\t<th>geändert</th>
\t\t\t\t\t<th>aktiv</th>

EOT;
            if (!$this->read_only) {
                $html .= <<<EOT
\t\t\t\t\t<th>Priorität</th>

EOT;
            }
            $html .= <<<EOT
\t\t\t\t</tr>

EOT;
            $sw = 1;
            $next_sw = array(1 => 2, 2 => 1);
            $i = 0;
            foreach ($this->products as $product) {
                $i++;
                $checked_str = isset($this->checked[$product->ID]) && $this->checked[$product->ID] ? ' checked' : '';
                $disabled_str = $this->read_only ? ' disabled' : '';
                $title = htmlspecialchars($product->Title);
                $plink = KIWI_EDIT_PRODUCT . "?p={$product->PID}";
                $anchor_str = $this->anchor->ID == $product->ID ? ' id="zmena"' : '';
                $new_cost = htmlspecialchars(sprintf("%01.2f", $product->NewCost));
                if ($product->Photo) {
                    $photo = 'photoOK';
                    $phototitle = 'Produkt hat Foto';
                } else {
                    $photo = 'photoKO';
                    $phototitle = 'Foto nicht verfügbar';
                }
                $photostr = <<<EOT
<img src="./image/{$photo}.gif" alt="" title="{$phototitle}" />
EOT;
                $novelty = $product->Novelty != 0 ? 'ja' : 'nein';
                $action = $product->Action != 0 ? 'ja' : 'nein';
                $discount = $product->Discount != 0 ? 'ja' : 'nein';
                $sellout = $product->Sellout != 0 ? 'ja' : 'nein';
                $active = $product->Active != 0 ? 'ja' : 'nein';
                $dt = parseDateTime($product->LastChange);
                $lastchange = date('j.n.Y H:i', $dt['stamp']);
                $html .= <<<EOT
\t\t\t\t<tr class="t-s-{$sw}">
\t\t\t\t\t<td><input type="checkbox" name="check[]" value="{$product->ID}" onclick="Kiwi_Newsletter_Form.enableBtns(this.checked);"{$disabled_str}{$checked_str} /></td>
\t\t\t\t\t<td><a href="{$plink}"{$anchor_str}>{$title}</a></td>
\t\t\t\t\t<td>{$new_cost}</td>
\t\t\t\t\t<td>{$novelty}</td>
\t\t\t\t\t<td>{$action}</td>
\t\t\t\t\t<td>{$discount}</td>
\t\t\t\t\t<td>{$sellout}</td>
\t\t\t\t\t<td>{$photostr}</td>
\t\t\t\t\t<td>{$lastchange}</td>
\t\t\t\t\t<td>{$active}</td>

EOT;
                if (!$this->read_only) {
                    $nullimg = "<img src=\"./image/null.gif\" alt=\"\" title=\"\" width=\"18\" height=\"18\" />";
                    $html .= "\t\t\t\t\t<td>" . ($i < count($this->products) - 1 ? "<a href=\"{$self}{$qs}&dd={$product->ID}\"><img src=\"./image/alldown.gif\" alt=\"\" title=\"ganz unten\" width=\"18\" height=\"18\" /></a>" : $nullimg) . ($i < count($this->products) ? "<a href=\"{$self}{$qs}&d={$product->ID}\"><img src=\"./image/down.gif\" alt=\"\" title=\"unten\" width=\"18\" height=\"18\" /></a>" : $nullimg) . ($i > 1 ? "<a href=\"{$self}{$qs}&u={$product->ID}\"><img src=\"./image/up.gif\" alt=\"\" title=\"oben\" width=\"18\" height=\"18\" /></a>" : $nullimg) . ($i > 2 ? "<a href=\"{$self}{$qs}&uu={$product->ID}\"><img src=\"./image/allup.gif\" alt=\"\" title=\"ganz oben\" width=\"18\" height=\"18\" /></a>" : $nullimg) . "</td>\n";
                }
                $html .= <<<EOT
\t\t\t\t</tr>

EOT;
                $sw = $next_sw[$sw];
            }
            $html .= <<<EOT
\t\t\t</table>
\t\t</div>
\t</div>
\t<div class="form2">
\t\t<fieldset>

EOT;
            if ($this->read_only || count($this->checked) == 0) {
                $disabled_str = ' disabled';
                $but_class = 'but3D';
            } else {
                $disabled_str = '';
                $but_class = 'but3';
            }
            $html .= <<<EOT
\t\t\t<input type="submit" id="knlrfc_cmd4" name="cmd" value="Artikel hinzufügen" class="but4{$D_str}"{$ro_disabled_str} />
\t\t\t<input type="submit" id="knlrfc_cmd5" name="cmd" value="entfernen" class="{$but_class}"{$disabled_str} onclick="return Kiwi_Newsletter_Form.onDelete()" />
\t\t</fieldset>
\t</div>

EOT;
        }
        $html .= <<<EOT
</form>

EOT;
        return $html;
    }
//--------------------------------------------------------------------------------------------------
// This script reads event data from a JSON file and outputs those events which are within the range
// supplied by the "start" and "end" GET parameters.
//
// An optional "timezone" GET parameter will force all ISO8601 date stings to a given timezone.
//
// Requires PHP 5.2.0 or higher.
//--------------------------------------------------------------------------------------------------
header('Access-Control-Allow-Origin: *');
header("Content-Type: application/json");
$usuario = $_REQUEST['user'];
// Require our Event class and datetime utilities
require dirname(__FILE__) . '/utils.php';
$range_start = parseDateTime("2015-09-04");
//$_GET['start']
$range_end = parseDateTime("2015-09-24");
//$_GET['end']
// Short-circuit if the client did not give us a date range.
if (!isset($range_start) || !isset($range_end)) {
    die("Please provide a date range.");
}
// Parse the start/end parameters.
// These are assumed to be ISO8601 strings with no time nor timezone, like "2013-12-29".
// Since no timezone will be present, they will parsed as UTC.
// Parse the timezone parameter if it is present.
$timezone = null;
if (isset($_GET['timezone'])) {
    $timezone = new DateTimeZone($_GET['timezone']);
}
// Read and parse our events JSON file into an array of event data arrays.
$link = mysqli_connect("localhost", "sumaton", "3quipo3mpowerL4bs");
 protected function loadData()
 {
     if ($this->data == null && $this->id) {
         $result = mysql_query("SELECT ID, AGID, Title, Description, Picture, Link, LastChange FROM eshopactions WHERE ID={$this->id}");
         if ($row = mysql_fetch_array($result)) {
             $this->data = new Kiwi_DataRow($row);
             $this->agid = $this->data->AGID;
             $this->title = $this->data->Title;
             $this->description = $this->data->Description;
             $this->link = $this->data->Link;
             $this->picture = $this->data->Picture;
             $dt = parseDateTime($this->data->LastChange);
             $this->lastchange = date('j.n.Y H:i', $dt['stamp']);
         } else {
             throw new Exception("Neplatný identifikátor akce");
         }
     }
     if ($this->agtitle == '') {
         $result = mysql_query("SELECT Title FROM actiongroups WHERE ID={$this->agid}");
         if ($row = mysql_fetch_row($result)) {
             $this->agtitle = $row[0];
         } else {
             throw new Exception("Neplatný identifikátor skupiny akcí!");
         }
     }
 }
    public function _getHTML()
    {
        $qs = $this->consQS();
        if ($this->id) {
            $this->loadRecord();
            $tname = $name = htmlspecialchars($this->record->Name);
            $url = htmlspecialchars($this->url);
            $htitle = htmlspecialchars($this->htitle);
            $description = str_replace("\r\n", "\r", htmlspecialchars($this->description));
            $frontmenu_checked_str = $this->flags & self::FLAG_FRONTMENU ? ' checked' : '';
            $dt = parseDateTime($this->record->LastChange);
            $lastchange = date('j.n. Y - H:i', $dt['stamp']);
        } else {
            $name = '';
            $tname = 'neu';
            $url = '';
            $htitle = '';
            $description = '';
            $frontmenu_checked_str = '';
            $lastchange = null;
        }
        if ($this->read_only) {
            $readonly_str = ' readonly';
            $readonly_str2 = ' disabled';
            $readonly_str3 = 'D';
            $onchange_str = '';
            $onchange_str3 = '';
            $ro_disabled_str = ' disabled';
            $D_str = 'D';
        } else {
            $readonly_str = $ro_disabled_str = $D_str = '';
            $readonly_str2 = '';
            $readonly_str3 = '';
            $onchange_str = ' onchange="Kiwi_EShopItem_Form.onChange()" onkeydown="return Kiwi_EShopItem_Form.onKeyDown(event)"';
            $onchange_str3 = ' onchange="Kiwi_EShopItem_Form.onChangeAuto()" onkeydown="Kiwi_EShopItem_Form.onKeyDownAuto(event)" onclick="Kiwi_EShopItem_Form.onChangeAuto()"';
        }
        $self = basename($_SERVER['PHP_SELF']);
        $html = <<<EOT
<form enctype="multipart/form-data" action="{$self}{$qs}" method="post">
\t<h2>[Serie] - {$tname} - [editieren]</h2>
\t<div class="levyV">
\t\t<div class="form3">
\t\t\t<fieldset>

EOT;
        if ($this->rights === true || $this->rights['EditURLs']) {
            if ($this->auto) {
                $checked_str = ' checked';
                if ($readonly_str == '') {
                    $disabled_str = ' disabled';
                } else {
                    $disabled_str = '';
                }
            } else {
                $checked_str = '';
                $disabled_str = '';
            }
            $ue_html = <<<EOT

\t\t\t\t\t<tr>
\t\t\t\t\t\t<td><span class="span-form2">Automatische URL und Titel :</span></td>
\t\t\t\t\t\t<td colspan="2"><input type="checkbox" id="keifc_auto" name="Auto"{$onchange_str3}{$readonly_str}{$checked_str} /></td>
\t\t\t\t\t</tr>
\t\t\t\t\t<tr>
\t\t\t\t\t\t<td><span class="span-form2">Serie URL :</span></td>
\t\t\t\t\t\t<td><input type="text" id="keifc_url" name="URL_rady" value="{$url}" class="inpOUT" onfocus="this.className='inpON'" onblur="this.className='inpOUT'"{$onchange_str}{$readonly_str}{$disabled_str} /></td>
\t\t\t\t\t</tr>
\t\t\t\t\t<tr>
\t\t\t\t\t\t<td><span class="span-form2">HTML-Titel :</span></td>
\t\t\t\t\t\t<td><input type="text" id="keifc_htitle" name="htitle_rady" value="{$htitle}" class="inpOUT" onfocus="this.className='inpON'" onblur="this.className='inpOUT'"{$onchange_str}{$readonly_str}{$disabled_str} /></td>
\t\t\t\t\t</tr>
EOT;
        } else {
            $ue_html = '';
        }
        if ($lastchange != null) {
            $html .= <<<EOT
\t\t\t\t<div class="zmena">Zuletzt Aktualisiert: {$lastchange}</div>

EOT;
        }
        if ($this->parent == 0) {
            $back_disabled_str = ' disabled';
            $back_disabled_D = 'D';
        } else {
            $back_disabled_str = '';
            $back_disabled_D = '';
        }
        $html .= <<<EOT
\t\t\t\t<div id="frame2">
\t\t\t\t\t<table class="tab-form" cellspacing="0" cellpadding="0">
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td><span class="span-form2">Bezeichnung :</span></td>
\t\t\t\t\t\t\t<td><input type="text" id="keifc_name" name="Nazev" value="{$name}" class="inpOUT" onfocus="this.className='inpON'" onblur="this.className='inpOFF'"{$onchange_str}{$readonly_str} /></td>
\t\t\t\t\t\t</tr>
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td><span class="span-form2">Icon der Serie :</span></td>

EOT;
        if ($this->icon) {
            $iconimg = KIWI_DIR_GROUPICONS . $this->icon;
            $html .= <<<EOT
\t\t\t\t\t\t\t<td><img src="{$iconimg}" alt="" /><input type="button" id="keifc_cmd9" name="removeIcon" value="entfernen" class="but3{$readonly_str3}" onclick="Kiwi_EShopItem_Form.onRemoveIcon('{$self}{$qs}')" {$readonly_str2}/></td>

EOT;
        } elseif ($this->read_only) {
            $html .= <<<EOT
\t\t\t\t\t\t\t<td>nicht verfügbar</td>

EOT;
        } else {
            $html .= <<<EOT
\t\t\t\t\t\t\t<td><input type="file" id="keifc_upload1" name="upload1" class="inpOUT" onfocus="this.className='inpON'" onblur="this.className='inpOUT'"{$onchange_str} /></td>

EOT;
        }
        $html .= <<<EOT
\t\t\t\t\t\t</tr>
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td><span class="span-form2">Beschreibung der Serie :</span></td>
\t\t\t\t\t\t\t<td><textarea type="text" id="keifc_desc" name="Popis" class="texarOUT" onfocus="this.className='texarON'" onblur="this.className='texarOUT'"{$onchange_str}{$readonly_str}>{$description}</textarea></td>
\t\t\t\t\t\t</tr>{$ue_html}
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td><span class="span-form2">Einführen im Hauptmenü :</span></td>
\t\t\t\t\t\t\t<td colspan="2"><input type="checkbox" id="keifc_mainmenu" name="mainmenu_flag"{$onchange_str}{$readonly_str}{$frontmenu_checked_str} /></td>
\t\t\t\t\t\t</tr>
\t\t\t\t\t</table>
\t\t\t\t</div>
\t\t\t\t<input type="submit" id="keifc_cmd1" name="cmd" value="speichern" class="but3D" disabled onclick="return Kiwi_EShopItem_Form.onSave()"/>
\t\t\t\t<input type="submit" id="keifc_cmd2" name="cmd" value="Zurück" class="but3{$back_disabled_D}"{$back_disabled_str} />
\t\t\t</fieldset>
\t\t</div>
\t</div>

EOT;
        if ($this->id) {
            $this->loadLastChange();
            $this->loadProducts();
            $disabled_str = sizeof($this->products) == 0 || $this->read_only ? ' disabled' : '';
            $all_checked_str = $this->all_checked ? ' checked' : '';
            $html .= <<<EOT
\t<h2>[Posten] - {$tname} - [anschliessende Artikel]</h2>
\t<div class="levyV">
\t\t<div class="zmena">Zuletzt Aktualisiert: {$this->lastchange->format()}</div>
\t\t<div id="frame">
\t\t\t<table class="tab-seznam" cellspacing="0" cellpadding="0">
\t\t\t\t<tr>
\t\t\t\t\t<th><input type="checkbox" name="checkall" value="Vsechny"{$disabled_str} onclick="checkUncheckAll(document.getElementsByName('check[]'),this);Kiwi_EShopItem_Form.enableBtns(false);"{$all_checked_str} /></th>
\t\t\t\t\t<th>Artikel-Name</th>
\t\t\t\t\t<th>Preis</th>
\t\t\t\t\t<th><span title="Neu">N</span></th>
\t\t\t\t\t<th><span title="Aktion">Ak</span></th>
\t\t\t\t\t<th><span title="Rabatt">R</span></th>
\t\t\t\t\t<th><span title="Ausferkauf">Au</span></th>
\t\t\t\t\t<th></th>
\t\t\t\t\t<th>geändert</th>
\t\t\t\t\t<th>aktiv</th>

EOT;
            if (!$this->read_only) {
                $html .= <<<EOT
\t\t\t\t\t<th>Priorität</th>

EOT;
            }
            $html .= <<<EOT
\t\t\t\t</tr>

EOT;
            $sw = 1;
            $next_sw = array(1 => 2, 2 => 1);
            $i = 0;
            foreach ($this->products as $product) {
                $i++;
                $checked_str = isset($this->checked[$product->ID]) && $this->checked[$product->ID] ? ' checked' : '';
                $disabled_str = $this->read_only ? ' disabled' : '';
                $title = htmlspecialchars($product->Title);
                $plink = KIWI_EDIT_PRODUCT . "?p={$product->PID}&ei={$this->id}";
                $anchor_str = $this->anchor->ID == $product->ID ? ' name="zmena"' : '';
                $new_cost = htmlspecialchars(sprintf("%01.2f", $product->NewCost));
                if ($product->Photo) {
                    $photo = 'photoOK';
                    $phototitle = 'Produkt hat Foto';
                } else {
                    $photo = 'photoKO';
                    $phototitle = 'Foto nicht verfügbar';
                }
                $photostr = <<<EOT
<img src="./image/{$photo}.gif" alt="" title="{$phototitle}" />
EOT;
                $novelty = $product->Novelty != 0 ? 'ja' : 'nein';
                $action = $product->Action != 0 ? 'ja' : 'nein';
                $discount = $product->Discount != 0 ? 'ja' : 'nein';
                $sellout = $product->Sellout != 0 ? 'ja' : 'nein';
                $dt = parseDateTime($product->LastChange);
                $lastchange = date('j.n.Y H:i', $dt['stamp']);
                $html .= <<<EOT
\t\t\t\t<tr class="t-s-{$sw}">
\t\t\t\t\t<td><input type="checkbox" name="check[]" value="{$product->ID}" onclick="Kiwi_EShopItem_Form.enableBtns(this.checked);"{$disabled_str}{$checked_str} /></td>
\t\t\t\t\t<td><a href="{$plink}"{$anchor_str}>{$title}</a></td>
\t\t\t\t\t<td>{$new_cost}</td>

EOT;
                if (!$this->read_only) {
                    $html .= <<<EOT
\t\t\t\t\t<td><a href="{$self}{$qs}&tn={$product->ID}">{$novelty}</a></td>
\t\t\t\t\t<td><a href="{$self}{$qs}&ta={$product->ID}">{$action}</a></td>
\t\t\t\t\t<td><a href="{$self}{$qs}&td={$product->ID}">{$discount}</a></td>
\t\t\t\t\t<td><a href="{$self}{$qs}&ts={$product->ID}">{$sellout}</a></td>

EOT;
                } else {
                    $html .= <<<EOT
\t\t\t\t\t<td>{$novelty}</td>
\t\t\t\t\t<td>{$action}</td>
\t\t\t\t\t<td>{$discount}</td>
\t\t\t\t\t<td>{$sellout}</td>

EOT;
                }
                $html .= <<<EOT
\t\t\t\t\t<td>{$photostr}</td>
\t\t\t\t\t<td>{$lastchange}</td>

EOT;
                $pac = $product->Active;
                $active = $pac ? 'ja' : 'nein';
                if (!$this->read_only && ($this->record->Active || $pac)) {
                    $asqvs = $pac ? 'd' : 'a';
                    $html .= <<<EOT
\t\t\t\t\t<td><a href="{$self}{$qs}&as{$asqvs}={$product->ID}">{$active}</a></td>

EOT;
                } else {
                    $html .= <<<EOT
\t\t\t\t\t<td>{$active}</td>

EOT;
                }
                if (!$this->read_only) {
                    $nullimg = "<img src=\"./image/null.gif\" alt=\"\" title=\"\" width=\"18\" height=\"18\" />";
                    $html .= "\t\t\t\t\t<td>" . ($i < sizeof($this->record->Products) - 1 ? "<a href=\"{$self}{$qs}&dd={$product->ID}\"><img src=\"./image/alldown.gif\" alt=\"\" title=\"ganz unten\" width=\"18\" height=\"18\" /></a>" : $nullimg) . ($i < sizeof($this->record->Products) ? "<a href=\"{$self}{$qs}&d={$product->ID}\"><img src=\"./image/down.gif\" alt=\"\" title=\"unten\" width=\"18\" height=\"18\" /></a>" : $nullimg) . ($i > 1 ? "<a href=\"{$self}{$qs}&u={$product->ID}\"><img src=\"./image/up.gif\" alt=\"\" title=\"oben\" width=\"18\" height=\"18\" /></a>" : $nullimg) . ($i > 2 ? "<a href=\"{$self}{$qs}&uu={$product->ID}\"><img src=\"./image/allup.gif\" alt=\"\" title=\"ganz oben\" width=\"18\" height=\"18\" /></a>" : $nullimg) . "</td>\n";
                }
                $html .= <<<EOT
\t\t\t\t</tr>

EOT;
                $sw = $next_sw[$sw];
            }
            $html .= <<<EOT
\t\t\t</table>
\t\t</div>
\t</div>
\t<div class="form2">
\t\t<fieldset>
\t\t\t<input type="submit" id="keifc_cmd3" name="cmd" value="neuer Artikel hinzufügen" class="but4{$D_str}"{$ro_disabled_str} />

EOT;
            if ($this->read_only || sizeof($this->checked) == 0) {
                $disabled_str = ' disabled';
                $but_class = 'but3D';
            } else {
                $disabled_str = '';
                $but_class = 'but3';
            }
            if (!$this->record->Active) {
                $disabled_str3 = ' disabled';
                $cmd68 = 8;
                $cmd79 = 9;
            } else {
                $disabled_str3 = $disabled_str;
                $cmd68 = 6;
                $cmd79 = 7;
            }
            $html .= <<<EOT
\t\t\t<input type="submit" id="keifc_cmd4" name="cmd" value="vorhandene Artikel hinzufügen" class="but4{$D_str}"{$ro_disabled_str} />
\t\t\t<input type="submit" id="keifc_cmd5" name="cmd" value="entfernen" class="{$but_class}"{$disabled_str} onclick="return Kiwi_EShopItem_Form.onDelete()" />
\t\t\t<input type="submit" id="keifc_cmd{$cmd68}" name="cmd" value="aktivieren" class="{$but_class}"{$disabled_str3} />
\t\t\t<input type="submit" id="keifc_cmd{$cmd79}" name="cmd" value="deaktivieren" class="{$but_class}"{$disabled_str3} />
\t\t</fieldset>
\t</div>

EOT;
        }
        $html .= <<<EOT
</form>

EOT;
        return $html;
    }
Exemple #16
0
<?php

require_once 'hortapp.dbLib.php';
require_once 'hortapp.events.utils.php';
// Short-circuit if the client did not give us a date range.
if (!isset($_POST['start']) || !isset($_POST['end'])) {
    die("Please provide a date range.");
}
$range_start = parseDateTime($_POST['start']);
$range_end = parseDateTime($_POST['end']);
$conexion = dbCon(2);
$res = array();
// sleep(1000);
$sql = "SELECT * FROM events WHERE user = "******"";
/**
*****************************************************************

to-do: add WHERE start > request.start AND start < request.end

start: 2015-05-06
request.start: 2015-05-31
request.end: 2015-07-12

formats compatibles!?
****************************************************************/
if ($events = query_escaped($conexion, $sql)) {
    // echo "into if";
    while ($event = mysqli_fetch_array($events)) {
        $event = new Event($event);
        if ($event->isWithinDayRange($range_start, $range_end)) {
            $res[] = $event->toArray();
    public function _getHTML()
    {
        $this->loadLastChange();
        $this->loadSubscriberCounts();
        $this->loadSubscribers();
        $self = basename($_SERVER['PHP_SELF']);
        $qs = htmlspecialchars($this->consQS());
        $qsep = $qs ? '&amp;' : '?';
        $html = <<<EOT
<form action="{$self}{$qs}" method="post">
\t<h2>E-SHOP Newsletters subscribers - [Liste]</h2>
\t<div class="levyV">

EOT;
        if ($this->lastchange !== null) {
            $html .= <<<EOT
\t\t<div class="zmena">Zuletzt Aktualisiert: {$this->lastchange->format()}</div>

EOT;
        }
        $tabs_html = '';
        $tqs = htmlspecialchars($this->consQS(array('l' => NULL, 'pg' => NULL)));
        $tqsep = $tqs == '' ? '?' : '&amp;';
        foreach ($this->fletters as $fletter => $flcount) {
            if ($fletter === self::KEY_TOTAL) {
                continue;
            }
            $fletterqs = urlencode($fletter);
            if ($this->letter == $fletter) {
                $tabs_html .= <<<EOT

\t\t\t<span title="{$flcount}">{$fletter}</span>
EOT;
            } elseif ($flcount == 0) {
                $tabs_html .= <<<EOT

\t\t\t<b>{$fletter}</b>
EOT;
            } else {
                $tabs_html .= <<<EOT

\t\t\t<a href="{$self}{$tqs}{$tqsep}l={$fletterqs}" title="{$flcount}">{$fletter}</a>
EOT;
            }
        }
        $pages = (int) ($this->total / self::$records_per_page + 1);
        $pages_html = '';
        if ($pages > 1) {
            $pqs = $this->consQS(array('pg' => NULL));
            $pqs .= $pqs == '' ? '?' : '&amp;';
            for ($pg = 1; $pg <= $pages; $pg++) {
                if ($pg == $this->page) {
                    $pages_html .= <<<EOT

\t\t\t<span>{$pg}</span>
EOT;
                } else {
                    $pages_html .= <<<EOT

\t\t\t<a href="{$self}{$pqs}pg={$pg}">{$pg}</a>
EOT;
                }
            }
        }
        $totalcount = $this->fletters[self::KEY_TOTAL];
        if ($this->letter === null) {
            $tabs_html .= <<<EOT
\t\t\t<span title="{$totalcount}">Alles</span>

EOT;
        } else {
            $tabs_html .= <<<EOT
\t\t\t<a href="{$self}{$tqs}" title="{$totalcount}">Alles</a>

EOT;
        }
        $statuses = array(self::STATUS_NOTSUBSCRIBED => array('adj' => 'not subscribed', 'verb' => FALSE), self::STATUS_UNSUBSCRIBED => array('adj' => 'unsubscribed', 'verb' => 'unsubscribe'), self::STATUS_SUBSCRIBED => array('adj' => 'subscribed', 'verb' => 'subscribe'), self::STATUS_BLOCKED => array('adj' => 'blocked', 'verb' => 'block'));
        foreach ($statuses as $status_code => $status_desc) {
            if ($status_code === self::STATUS_NOTSUBSCRIBED) {
                continue;
            }
            $status_adj = htmlspecialchars($status_desc['adj']);
            if (isset($this->filter[self::FILTER_STATUS]) && $this->filter[self::FILTER_STATUS] == $status_code) {
                $tabs_html .= <<<EOT
\t\t\t<span>{$status_adj}</span>

EOT;
            } else {
                $cqs = $this->consQS(array('f' => array(self::FILTER_STATUS => $status_code)));
                $tabs_html .= <<<EOT
\t\t\t<a href="{$self}{$cqs}">{$status_adj}</a>

EOT;
            }
        }
        if (!array_key_exists(self::FILTER_STATUS, $this->filter)) {
            $tabs_html .= <<<EOT
\t\t\t<span>all Statuses</span>

EOT;
        } else {
            $cqs = $this->consQS(array('f' => array(self::FILTER_STATUS => NULL)));
            $tabs_html .= <<<EOT
\t\t\t<a href="{$self}{$cqs}">all Statuses</a>

EOT;
        }
        $html .= <<<EOT
\t\t<div id="zalozky">{$tabs_html}

EOT;
        $search = htmlspecialchars($this->getSearchBoxText());
        $html .= <<<EOT
\t\t\t<div class="searchbox">
\t\t\t\t<input type="text" id="knlsfc_sbox" name="search" value="{$search}" class="searchinp" />
\t\t\t\t<!--[if IE]><input type="text" style="display: none;" disabled="disabled" size="1" /><![endif]-->
\t\t\t\t<input type="submit" id="knlsfc_sbtn" name="cmd" value="suchen" class="searchbtn" />
\t\t\t</div>
\t\t\t<br class="clear" />
\t\t</div>

EOT;
        if ($pages_html !== '') {
            $html .= <<<EOT
\t\t<div id="stranky">Seite: {$pages_html}
\t\t\t<br class="clear" />
\t\t</div>

EOT;
        }
        $disabled_str = count($this->subscribers) == 0 ? ' disabled' : '';
        $all_checked_str = $this->all_checked ? ' checked' : '';
        $html .= <<<EOT
\t\t<div id="frame">
\t\t\t<table class="tab-seznam" cellspacing="0" cellpadding="0">
\t\t\t\t<tr>
\t\t\t\t\t<th><input type="checkbox" name="checkall" value="Vsechny"{$disabled_str} onclick="checkUncheckAll(document.getElementsByName('check[]'),this);Kiwi_Subscribers_Form.enableBtns(false);"{$all_checked_str} /></th>
\t\t\t\t\t<th>Name</th>
\t\t\t\t\t<th>E-mail</th>
\t\t\t\t\t<th>Status</th>
\t\t\t\t\t<th>geändert</th>
\t\t\t\t\t<th></th>
\t\t\t\t</tr>

EOT;
        $sw = 1;
        $next_sw = array(1 => 2, 2 => 1);
        //mb_internal_encoding('UTF-8');
        foreach ($this->subscribers as $subscriber) {
            $checked_str = isset($this->checked[$subscriber->ID]) && $this->checked[$subscriber->ID] ? ' checked' : '';
            $email = htmlspecialchars($subscriber->Email);
            if ($subscriber->ClientID) {
                $clientLink = KIWI_EDIT_CLIENT . "?c={$subscriber->ClientID}";
                if ($subscriber->BusinessName) {
                    $name = htmlspecialchars($subscriber->BusinessName);
                    $clientstatus_icon = 'clientF';
                    $clientstatus_text = 'Firma';
                } else {
                    $name = htmlspecialchars(($subscriber->Title ? "{$subscriber->Title} " : '') . "{$subscriber->FirstName} {$subscriber->SurName}");
                    $clientstatus_icon = 'clientP';
                    $clientstatus_text = 'Privatperson';
                }
                $clientstatus_str = <<<EOT
<a href="{$clientLink}"><img src="./image/{$clientstatus_icon}.gif" alt="{$clientstatus_text}" />&nbsp;{$name}</a>
EOT;
            } else {
                $clientstatus_str = '';
            }
            $sqs = $this->saveQS();
            //			if ($sqs) $plink .= "&sqs=$sqs";
            $anchor_str = $this->anchor->ID == $subscriber->ID ? ' name="zmena"' : '';
            $status = isset($statuses[$subscriber->Status]) ? $statuses[$subscriber->Status]['adj'] : $subscriber->Status;
            $dt = parseDateTime($subscriber->LastChange);
            $lastchange = date('j.n.Y H:i', $dt['stamp']);
            $changestatus_str = '';
            foreach ($statuses as $status_code => $status_desc) {
                if ($status_desc['verb'] === FALSE) {
                    continue;
                }
                $status_name_str = htmlspecialchars($status_desc['verb']);
                if ($changestatus_str !== '') {
                    $changestatus_str .= ' ';
                }
                if ($subscriber->Status == $status_code) {
                    $current_str = " class='current'";
                } else {
                    $current_str = '';
                }
                $changestatus_str .= <<<EOT
<a href="{$self}{$qs}{$qsep}sid={$subscriber->ID}&amp;sc={$status_code}"{$current_str}>{$status_name_str}</a>
EOT;
            }
            $html .= <<<EOT
\t\t\t\t<tr class="t-s-{$sw} subscriber-status-{$subscriber->Status}">
\t\t\t\t\t<td><input type="checkbox" name="check[]" value="{$subscriber->ID}" onclick="Kiwi_Subscribers_Form.enableBtns(this.checked)"{$checked_str} /></td>
\t\t\t\t\t<td>{$clientstatus_str}</td>
\t\t\t\t\t<td>{$email}</td>
\t\t\t\t\t<td class="subscriber-status">{$status}</td>
\t\t\t\t\t<td>{$lastchange}</td>
\t\t\t\t\t<td>{$changestatus_str}</td>
\t\t\t\t</tr>

EOT;
            $sw = $next_sw[$sw];
        }
        if (count($this->checked) == 0) {
            $disabled_str = ' disabled';
            $but_class = 'but3D';
        } else {
            $disabled_str = '';
            $but_class = 'but3';
        }
        //			<input type="submit" id="knlsfc_cmd1" name="cmd" value="Newsletter hinzufügen" class="but4" />
        $html .= <<<EOT
\t\t\t</table>
\t\t</div>
\t</div>
\t<div class="form2">
\t\t<fieldset>
\t\t\t<input type="submit" id="knlsfc_cmd2" name="cmd" value="entfernen" class="{$but_class}"{$disabled_str} onclick="return Kiwi_Subscribers_Form.onDelete()" />
\t\t\t<input type="submit" id="knlsfc_cmd3" name="cmd" value="subscribe" class="{$but_class}"{$disabled_str} />
\t\t\t<input type="submit" id="knlsfc_cmd4" name="cmd" value="unsubscribe" class="{$but_class}"{$disabled_str} />
\t\t\t<input type="submit" id="knlsfc_cmd5" name="cmd" value="block" class="{$but_class}"{$disabled_str} />
\t\t</fieldset>
\t</div>
</form>

EOT;
        return $html;
    }
    public function _getHTML()
    {
        $this->loadLastChange();
        $this->loadActionGroups();
        $self = basename($_SERVER['PHP_SELF']);
        $html = <<<EOT
<form action="{$self}" method="post">
\t<h2>Gruppe Aktionen - [Liste]</h2>
\t<div class="levyV">

EOT;
        if ($this->lastchange != null) {
            $html .= <<<EOT
\t\t<div class="zmena">Zuletzt Aktualisiert: {$this->lastchange->format()}</div>

EOT;
        }
        $disabled_str = sizeof($this->actiongroups) == 0 ? ' disabled' : '';
        $all_checked_str = $this->all_checked ? ' checked' : '';
        $html .= <<<EOT
\t\t<div id="frame">
\t\t\t<table class="tab-seznam" cellspacing="0" cellpadding="0">
\t\t\t\t<tr>
\t\t\t\t\t<th><input type="checkbox" name="checkall" value="Vsechny"{$disabled_str} onclick="checkUncheckAll(document.getElementsByName('check[]'),this);Kiwi_ActionGroups_Form.enableBtns(false);"{$all_checked_str} /></th>
\t\t\t\t\t<th>Name</th>
\t\t\t\t\t<th>Aktionen</th>
\t\t\t\t\t<th>geändert</th>
\t\t\t\t\t<th>aktiv</th>
\t\t\t\t</tr>

EOT;
        $sw = 1;
        $next_sw = array(1 => 2, 2 => 1);
        $i = 0;
        foreach ($this->actiongroups as $actiongroup) {
            $i++;
            $checked_str = isset($this->checked[$actiongroup->ID]) && $this->checked[$actiongroup->ID] ? ' checked' : '';
            $title = htmlspecialchars($actiongroup->Title);
            $plink = KIWI_ACTIONS . "?ag={$actiongroup->ID}";
            if ($actiongroup->Usage) {
                $usage = $actiongroup->Usage;
                if ($actiongroup->Usage > $actiongroup->ActiveUsage) {
                    $aktivni = 'aktivní';
                    if ($actiongroup->ActiveUsage > 4) {
                        $aktivni .= 'ch';
                    }
                    $usage .= " ({$actiongroup->ActiveUsage} {$aktivni})";
                }
            } else {
                $usage = '0';
            }
            $dt = parseDateTime($actiongroup->LastChange);
            $lastchange = date('j.n.Y H:i', $dt['stamp']);
            $active = $actiongroup->Active != 0 ? 'ja' : 'nein';
            $html .= <<<EOT
\t\t\t\t<tr class="t-s-{$sw}">
\t\t\t\t\t<td><input type="checkbox" name="check[]" value="{$actiongroup->ID}" onclick="Kiwi_ActionGroups_Form.enableBtns(this.checked)"{$checked_str} /></td>
\t\t\t\t\t<td><a href="{$plink}">{$title}</a></td>
\t\t\t\t\t<td>{$usage}</td>
\t\t\t\t\t<td>{$lastchange}</td>
\t\t\t\t\t<td><a href="{$self}?as={$actiongroup->ID}">{$active}</a></td>
\t\t\t\t</tr>

EOT;
            $sw = $next_sw[$sw];
        }
        if (sizeof($this->checked) == 0) {
            $disabled_str = ' disabled';
            $but_class = 'but3D';
        } else {
            $disabled_str = '';
            $but_class = 'but3';
        }
        $html .= <<<EOT
\t\t\t</table>
\t\t</div>
\t</div>
\t<div class="form2">
\t\t<fieldset>

EOT;
        /* Prozatím není možno přidávat skupiny akcí
        		$html .= <<<EOT
        			<input type="submit" id="kagfc_cmd1" name="cmd" value="Gruppe hinzufügen" class="but3" />
        			<input type="submit" id="kagfc_cmd2" name="cmd" value="entfernen" class="$but_class"$disabled_str onclick="return Kiwi_ActionGroups_Form.onDelete()" />
        
        EOT;
        */
        $html .= <<<EOT
\t\t\t<input type="submit" id="kagfc_cmd3" name="cmd" value="aktivieren" class="{$but_class}"{$disabled_str} />
\t\t\t<input type="submit" id="kagfc_cmd4" name="cmd" value="deaktivieren" class="{$but_class}"{$disabled_str} />
\t\t</fieldset>
\t</div>
</form>

EOT;
        return $html;
    }
 protected function loadData()
 {
     if ($this->data === null && $this->id != 0) {
         $sqlfields = array();
         foreach (self::$fields as $key => $value) {
             if (is_array($value) && ($value[1] < 0 || ($value[1] & 8) == 0)) {
                 $sqlfields[] = $key;
             }
         }
         $sql = 'SELECT YID, Year(Created) AS Year, ProductsTotalCost, Delivery, DeliveryCost, Payment, PaymentCost, Note, Status, PackageCode, Created, LastChange, ' . implode(', ', $sqlfields) . " FROM eshoporders WHERE ID={$this->id}";
         $result = mysql_query($sql);
         if ($row = mysql_fetch_array($result)) {
             $this->data = new Kiwi_DataRow($row);
             $dt = parseDateTime($this->data->LastChange);
             $this->lastchange = date('j.n.Y H:i', $dt['stamp']);
             $this->loadOrderRows();
         } else {
             throw new Exception('Neplatný identifikátor objednávky');
         }
     }
 }
Exemple #20
0
 public function feed($emp_id = "")
 {
     require FCPATH . 'assets/js/fullcalendar/demos/php/utils.php';
     if ($emp_id !== "") {
         //check can see this profile is_your_headman or is_hr
         $user_detail = getEmployeeDetail($emp_id);
         $checker = FALSE;
         $headman_level = 0;
         list($checker, $headman_level) = is_your_headman($user_detail["UserID"], $this->user_id);
         if ($checker == TRUE || is_hr()) {
             $this->emp_id = $emp_id;
             $this->user_id = $user_detail["UserID"];
         }
     }
     // Short-circuit if the client did not give us a date range.
     if (!isset($_POST['start']) || !isset($_POST['end'])) {
         die("Please provide a date range.");
     }
     // Parse the start/end parameters.
     // These are assumed to be ISO8601 strings with no time nor timezone, like "2013-12-29".
     // Since no timezone will be present, they will parsed as UTC.
     $range_start = $_POST['start'];
     $range_end = $_POST['end'];
     // Parse the timezone parameter if it is present.
     $timezone = null;
     if (isset($_GET['timezone'])) {
         $timezone = new DateTimeZone($_GET['timezone']);
     }
     // Read and parse our events JSON file into an array of event data arrays.
     $this->load->model("Worktime_model", "worktime");
     $query = $this->worktime->getListForCalendar($this->user_id, $range_start, $range_end);
     $output_arrays = array();
     if ($query->num_rows() > 0) {
         foreach ($query->result_array() as $row) {
             $data = array();
             $data["title"] = "เข้างาน : " . $row["WTTimeStart"];
             $data["allDay"] = true;
             $data["start"] = $row["WTDate"];
             $data["end"] = $row["WTDate"];
             $event = new Event($data, $timezone);
             if ($event->isWithinDayRange(parseDateTime($range_start), parseDateTime($range_end))) {
                 $output_arrays[] = $event->toArray();
             }
             $data["title"] = "เลิกงาน : " . $row["WTTimeEnd"];
             $data["allDay"] = true;
             $data["start"] = $row["WTDate"];
             $data["end"] = $row["WTDate"];
             $event = new Event($data, $timezone);
             if ($event->isWithinDayRange(parseDateTime($range_start), parseDateTime($range_end))) {
                 $output_arrays[] = $event->toArray();
             }
         }
     }
     // Send JSON to the client.
     echo json_encode($output_arrays);
 }
Exemple #21
0
 public function adminAjaxSorgu()
 {
     //session güvenlik kontrolü
     $form = $this->load->otherClasses('Form');
     $sessionKey = $form->sessionKontrol();
     if ($_POST && $_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest" && Session::get("BSShuttlelogin") == true && Session::get("sessionkey") == $sessionKey && Session::get("selectFirmaDurum") != 0) {
         $sonuc = array();
         //model bağlantısı
         $Panel_Model = $this->load->model("Panel_Model");
         //language
         $lang = Session::get("dil");
         $formlanguage = $this->load->ajaxlanguage($lang);
         $languagedeger = $formlanguage->ajaxlanguage();
         $form->post("tip", true);
         $tip = $form->values['tip'];
         switch ($tip) {
             case "soforEkleSelect":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $adminRutbe = Session::get("userRutbe");
                     //super adminse tüm bölgeler çekilir
                     if ($adminRutbe != 0) {
                         //bölgeleri getirir
                         $bolgeListe = $Panel_Model->aracBolgeListele();
                         $a = 0;
                         foreach ($bolgeListe as $bolgelist) {
                             $adminBolge['AdminBolge'][$a] = $bolgelist['SBBolgeAdi'];
                             $adminBolge['AdminBolgeID'][$a] = $bolgelist['SBBolgeID'];
                             $a++;
                         }
                     } else {
                         $bolgeListeRutbe = $Panel_Model->AdminbolgeListele($adminID);
                         foreach ($bolgeListeRutbe as $rutbe) {
                             $bolgerutbeId[] = $rutbe['BSBolgeID'];
                         }
                         $rutbebolgedizi = implode(',', $bolgerutbeId);
                         $bolgeListe = $Panel_Model->soforRutbeBolgeListele($rutbebolgedizi);
                         $a = 0;
                         foreach ($bolgeListe as $bolgelist) {
                             $adminBolge['AdminBolge'][$a] = $bolgelist['SBBolgeAdi'];
                             $adminBolge['AdminBolgeID'][$a] = $bolgelist['SBBolgeID'];
                             $a++;
                         }
                     }
                     $sonuc["adminBolge"] = $adminBolge;
                 }
                 break;
             case "soforAracMultiSelect":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $aracBolgeID = $_REQUEST['soforBolgeID'];
                     $multisofordizi = implode(',', $aracBolgeID);
                     $soforBolgeListe = $Panel_Model->aracMultiSelectBolge($multisofordizi);
                     foreach ($soforBolgeListe as $soforBolgeListee) {
                         $aracrutbeId[] = $soforBolgeListee['SBAracID'];
                     }
                     $rutbearacdizi = implode(',', $aracrutbeId);
                     //bölgeleri getirir
                     $aracListe = $Panel_Model->aracMultiSelect($rutbearacdizi);
                     $a = 0;
                     foreach ($aracListe as $aracListee) {
                         $soforAracSelect['AracSelectID'][$a] = $aracListee['SBAracID'];
                         $soforAracSelect['AracSelectPlaka'][$a] = $aracListee['SBAracPlaka'];
                         $a++;
                     }
                     $sonuc["aracMultiSelect"] = $soforAracSelect;
                 }
                 break;
             case "soforKaydet":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $userTip = 2;
                     $firmaID = Session::get("FirmaId");
                     $userKadi = $form->kadiOlustur($firmaID);
                     if ($userKadi) {
                         $realSifre = $form->sifreOlustur();
                         if ($realSifre) {
                             $adminSifre = $form->userSifreOlustur($userKadi, $realSifre, $userTip);
                             if ($adminSifre) {
                                 $form->post('soforAd', true);
                                 $form->post('soforSoyad', true);
                                 $form->post('soforEmail', true);
                                 $form->post('soforDurum', true);
                                 $form->post('soforLokasyon', true);
                                 $form->post('soforTelefon', true);
                                 $form->post('soforAdres', true);
                                 $form->post('aciklama', true);
                                 $form->post('ulke', true);
                                 $form->post('il', true);
                                 $form->post('ilce', true);
                                 $form->post('semt', true);
                                 $form->post('mahalle', true);
                                 $form->post('sokak', true);
                                 $form->post('postakodu', true);
                                 $form->post('caddeno', true);
                                 $form->post('detayAdres', true);
                                 $soforAd = $form->values['soforAd'];
                                 $soforSoyad = $form->values['soforSoyad'];
                                 $soforAdSoyad = $soforAd . ' ' . $soforSoyad;
                                 $soforEmail = $form->values['soforEmail'];
                                 $soforBolgeID = $_REQUEST['soforBolgeID'];
                                 $soforBolgeAdi = $_REQUEST['soforBolgeAdi'];
                                 $soforAracID = $_REQUEST['soforAracID'];
                                 $soforAracPlaka = $_REQUEST['soforAracPlaka'];
                                 if (!filter_var($soforEmail, FILTER_VALIDATE_EMAIL) === false) {
                                     $emailValidate = $form->mailControl1($soforEmail);
                                     if ($emailValidate == 1) {
                                         $kullaniciliste = $Panel_Model->soforEmailDbKontrol($soforEmail);
                                         if (count($kullaniciliste) <= 0) {
                                             if ($form->submit()) {
                                                 $data = array('BSSoforAd' => $soforAd, 'BSSoforSoyad' => $soforSoyad, 'BSSoforKadi' => $userKadi, 'BSSoforSifre' => $adminSifre, 'BSSoforRSifre' => $realSifre, 'BSSoforPhone' => $form->values['soforTelefon'], 'BSSoforEmail' => $soforEmail, 'BSSoforLocation' => $form->values['soforLokasyon'], 'BSSoforUlke' => $form->values['ulke'], 'BSSoforIl' => $form->values['il'], 'BSSoforIlce' => $form->values['ilce'], 'BSSoforSemt' => $form->values['semt'], 'BSSoforMahalle' => $form->values['mahalle'], 'BSSoforSokak' => $form->values['sokak'], 'BSSoforPostaKodu' => $form->values['postakodu'], 'BSSoforCaddeNo' => $form->values['caddeno'], 'BSSoforAdres' => $form->values['soforAdres'], 'BSSoforDetayAdres' => $form->values['detayAdres'], 'Status' => $form->values['soforDurum'], 'BSSoforAciklama' => $form->values['aciklama']);
                                             }
                                             $resultSoforID = $Panel_Model->addNewSofor($data);
                                             if ($resultSoforID != 'unique') {
                                                 $bolgeID = count($soforBolgeID);
                                                 if ($bolgeID > 0) {
                                                     for ($b = 0; $b < $bolgeID; $b++) {
                                                         $bolgedata[$b] = array('BSSoforID' => $resultSoforID, 'BSSoforAd' => $soforAdSoyad, 'BSBolgeID' => $soforBolgeID[$b], 'BSBolgeAdi' => $soforBolgeAdi[$b]);
                                                     }
                                                     $resultBolgeID = $Panel_Model->addNewBolgeSofor($bolgedata);
                                                     if ($resultBolgeID) {
                                                         //kullanıcıya gerekli giriş mail yazısı
                                                         $setTitle = $languagedeger['UyelikBilgi'];
                                                         $subject = $languagedeger['SHtrltMail'];
                                                         $body = $languagedeger['Merhaba'] . ' ' . $soforAdSoyad . '!<br/>' . $languagedeger['KullaniciAdi'] . ' = ' . $userKadi . '<br/>' . $languagedeger['KullaniciSifre'] . ' = ' . $realSifre . '<br/>' . $languagedeger['IyiGunler'];
                                                         //şoföre araç seçildi ise
                                                         $aracID = count($soforAracID);
                                                         if ($aracID > 0) {
                                                             for ($c = 0; $c < $aracID; $c++) {
                                                                 $aracdata[$c] = array('BSAracID' => $soforAracID[$c], 'BSAracPlaka' => $soforAracPlaka[$c], 'BSSoforID' => $resultSoforID, 'BSSoforAd' => $soforAdSoyad);
                                                             }
                                                             $resultAracID = $Panel_Model->addNewAracSofor($aracdata);
                                                             //kullanıcıya gerekli giriş bilgileri gönderiliyor.
                                                             $resultMail = $form->sifreHatirlatMail($soforEmail, $setTitle, $soforAdSoyad, $subject, $body);
                                                             $sonuc["newSoforID"] = $resultSoforID;
                                                             $sonuc["insert"] = $languagedeger['SoforEkle'];
                                                         } else {
                                                             //kullanıcıya gerekli giriş bilgileri gönderiliyor.
                                                             $resultMail = $form->sifreHatirlatMail($soforEmail, $setTitle, $soforAdSoyad, $subject, $body);
                                                             $sonuc["newSoforID"] = $resultSoforID;
                                                             $sonuc["insert"] = $languagedeger['SoforEkle'];
                                                         }
                                                     } else {
                                                         //admin kaydedilirken hata geldi ise
                                                         $deleteresult = $Panel_Model->soforDelete($resultSoforID);
                                                         if ($deleteresult) {
                                                             $sonuc["hata"] = $languagedeger['Hata'];
                                                         }
                                                     }
                                                 } else {
                                                     //eğer şoförün bölgesi yoksa
                                                     $deleteresult = $Panel_Model->soforDelete($resultSoforID);
                                                     $sonuc["hata"] = $languagedeger['BolgeSec'];
                                                 }
                                             } else {
                                                 $sonuc["hata"] = $languagedeger['GecersizKullanici'];
                                             }
                                         } else {
                                             $sonuc["hata"] = $languagedeger['KullanilmisEmail'];
                                         }
                                     } else {
                                         $sonuc["hata"] = $languagedeger['BaskaEmail'];
                                     }
                                 } else {
                                     $sonuc["hata"] = $languagedeger['GecerliEmail'];
                                 }
                             } else {
                                 $sonuc["hata"] = $languagedeger['Hata'];
                             }
                         } else {
                             $sonuc["hata"] = $languagedeger['Hata'];
                         }
                     } else {
                         $sonuc["hata"] = $languagedeger['Hata'];
                     }
                 }
             case "soforDetail":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $adminRutbe = Session::get("userRutbe");
                     //superadminse
                     if ($adminRutbe != 0) {
                         $form->post('soforRowid', true);
                         $soforDetailID = $form->values['soforRowid'];
                         $soforBolge = $Panel_Model->soforDetailBolge($soforDetailID);
                         //arac bölge idler
                         $a = 0;
                         foreach ($soforBolge as $soforBolgee) {
                             $selectSoforBolge[$a]['SelectSoforBolgeID'] = $soforBolgee['BSBolgeID'];
                             $selectSoforBolge[$a]['SelectSoforBolgeAdi'] = $soforBolgee['BSBolgeAdi'];
                             $soforbolgeId[] = $soforBolgee['BSBolgeID'];
                             $a++;
                         }
                         //araca ait bölge varmı(kesin oalcak arac a bölge seçtirmeden ekletmiyoruz
                         $soforCountBolge = count($soforbolgeId);
                         if ($soforCountBolge > 0) {
                             $soforbolgedizi = implode(',', $soforbolgeId);
                             //aracın bolgesi dışındakiler
                             $digerBolge = $Panel_Model->soforDetailSBolge($soforbolgedizi);
                             //arac diğer bölgeler
                             $b = 0;
                             foreach ($digerBolge as $digerBolgee) {
                                 $digerSoforBolge[$b]['DigerSoforBolgeID'] = $digerBolgee['SBBolgeID'];
                                 $digerSoforBolge[$b]['DigerSoforBolgeAdi'] = $digerBolgee['SBBolgeAdi'];
                                 $b++;
                             }
                         }
                         //admin araç seçili şoför
                         $adminSoforArac = $Panel_Model->adminDetailSoforArac($soforDetailID);
                         $soforAracCount = count($adminSoforArac);
                         //eğer aracın seçili şoförü varsa burası gelecek
                         if ($soforAracCount > 0) {
                             //arac Şofor idler
                             $c = 0;
                             foreach ($adminSoforArac as $adminSoforAracc) {
                                 $selectSoforArac[$c]['SelectSoforAracID'] = $adminSoforAracc['BSAracID'];
                                 $selectSoforArac[$c]['SelectSoforAracPlaka'] = $adminSoforAracc['BSAracPlaka'];
                                 $soforaracId[] = $adminSoforAracc['BSAracID'];
                                 $c++;
                             }
                             //seçili olan bölge
                             $soforbolgedizim = implode(',', $soforbolgeId);
                             //seöili olan arac
                             $soforbolgearac = implode(',', $soforaracId);
                             //adamın seçili olab bölgedeki diğer aracları
                             $adminSoforBolgeArac = $Panel_Model->adminSelectSoforBolge($soforbolgedizim, $soforbolgearac);
                             if (count($adminSoforBolgeArac) > 0) {
                                 $d = 0;
                                 foreach ($adminSoforBolgeArac as $adminSoforBolgeAracc) {
                                     $digerSoforArac[$d]['DigerSoforAracID'] = $adminSoforBolgeAracc['SBAracID'];
                                     $digerSoforArac[$d]['DigerSoforAracPlaka'] = $adminSoforBolgeAracc['SBAracPlaka'];
                                     $d++;
                                 }
                             }
                         } else {
                             //seçili olan bölge
                             $soforbolgedizim = implode(',', $soforbolgeId);
                             //adamın seçili olab bölgedeki diğer araçları
                             $adminSoforBolgeArac = $Panel_Model->adminSelectBolgeArac($soforbolgedizim);
                             $d = 0;
                             foreach ($adminSoforBolgeArac as $adminSoforBolgeAracc) {
                                 $digerSoforArac[$d]['DigerSoforAracID'] = $adminSoforBolgeAracc['SBAracID'];
                                 $digerSoforArac[$d]['DigerSoforAracPlaka'] = $adminSoforBolgeAracc['SBAracPlaka'];
                                 $d++;
                             }
                         }
                         //araç Özellikleri
                         $soforOzellik = $Panel_Model->soforDetail($soforDetailID);
                         $e = 0;
                         foreach ($soforOzellik as $soforOzellikk) {
                             $soforList[$e]['SoforListID'] = $soforOzellikk['BSSoforID'];
                             $soforList[$e]['SoforListAd'] = $soforOzellikk['BSSoforAd'];
                             $soforList[$e]['SoforListSoyad'] = $soforOzellikk['BSSoforSoyad'];
                             $soforList[$e]['SoforListTelefon'] = $soforOzellikk['BSSoforPhone'];
                             $soforList[$e]['SoforListMail'] = $soforOzellikk['BSSoforEmail'];
                             $soforList[$e]['SoforListLokasyon'] = $soforOzellikk['BSSoforLocation'];
                             $soforList[$e]['SoforListUlke'] = $soforOzellikk['BSSoforUlke'];
                             $soforList[$e]['SoforListIl'] = $soforOzellikk['BSSoforIl'];
                             $soforList[$e]['SoforListIlce'] = $soforOzellikk['BSSoforIlce'];
                             $soforList[$e]['SoforListSemt'] = $soforOzellikk['BSSoforSemt'];
                             $soforList[$e]['SoforListMahalle'] = $soforOzellikk['BSSoforMahalle'];
                             $soforList[$e]['SoforListSokak'] = $soforOzellikk['BSSoforSokak'];
                             $soforList[$e]['SoforListPostaKodu'] = $soforOzellikk['BSSoforPostaKodu'];
                             $soforList[$e]['SoforListCaddeNo'] = $soforOzellikk['BSSoforCaddeNo'];
                             $soforList[$e]['SoforListAdres'] = $soforOzellikk['BSSoforAdres'];
                             $soforList[$e]['SoforListDetayAdres'] = $soforOzellikk['BSSoforDetayAdres'];
                             $soforList[$e]['SoforListDurum'] = $soforOzellikk['Status'];
                             $soforList[$e]['SoforListAciklama'] = $soforOzellikk['BSSoforAciklama'];
                             $e++;
                         }
                     } else {
                         $adminID = Session::get("userId");
                         //normal adminse
                         $form->post('soforRowid', true);
                         $soforDetailID = $form->values['soforRowid'];
                         //küçük adminin olan bölgeleri
                         $bolgeListeRutbe = $Panel_Model->AdminbolgeListele($adminID);
                         //bölge idler
                         $bolgerutbeId = [];
                         foreach ($bolgeListeRutbe as $bolgeListeRutbee) {
                             $bolgerutbeId[] = $bolgeListeRutbee['BSBolgeID'];
                         }
                         $rutbebolgedizi = implode(',', $bolgerutbeId);
                         $soforBolge = $Panel_Model->adminDetailSoforBolge($soforDetailID);
                         //arac bölge idler
                         //arac bölge idler
                         $soforbolgeId = [];
                         $a = 0;
                         foreach ($soforBolge as $soforBolgee) {
                             $selectSoforBolge[$a]['SelectSoforBolgeID'] = $soforBolgee['BSBolgeID'];
                             $selectSoforBolge[$a]['SelectSoforBolgeAdi'] = $soforBolgee['BSBolgeAdi'];
                             $soforbolgeId[] = $soforBolgee['BSBolgeID'];
                             $a++;
                         }
                         //küçük admine göre farkını alıp, select olmayan bölgeleri çıkarıyoruz
                         $bolgefark = array_diff($bolgerutbeId, $soforbolgeId);
                         $bolgefarkk = implode(',', $bolgefark);
                         //aracın bolgesi dışındakiler
                         $digerBolge = $Panel_Model->adminRutbeDetailAracSBolge($bolgefarkk);
                         //arac diğer bölgeler
                         $b = 0;
                         foreach ($digerBolge as $digerBolgee) {
                             $digerSoforBolge[$b]['DigerSoforBolgeID'] = $digerBolgee['SBBolgeID'];
                             $digerSoforBolge[$b]['DigerSoforBolgeAdi'] = $digerBolgee['SBBolgeAdi'];
                             $b++;
                         }
                         //admin araç seçili şoför
                         $adminSoforArac = $Panel_Model->adminDetailSoforArac($soforDetailID);
                         $soforAracCount = count($adminSoforArac);
                         if ($soforAracCount > 0) {
                             //arac Şofor idler
                             $c = 0;
                             foreach ($adminSoforArac as $adminSoforAracc) {
                                 $selectSoforArac[$c]['SelectSoforAracID'] = $adminSoforAracc['BSAracID'];
                                 $selectSoforArac[$c]['SelectSoforAracPlaka'] = $adminSoforAracc['BSAracPlaka'];
                                 $soforaracId[] = $adminSoforAracc['BSAracID'];
                                 $c++;
                             }
                             //seçili olan bölge
                             $soforbolgedizim = implode(',', $soforbolgeId);
                             //seöili olan arac
                             $soforbolgearac = implode(',', $soforaracId);
                             //adamın seçili olab bölgedeki diğer aracları
                             $adminSoforBolgeArac = $Panel_Model->adminSelectSoforBolge($soforbolgedizim, $soforbolgearac);
                             if (count($adminSoforBolgeArac) > 0) {
                                 $d = 0;
                                 foreach ($adminSoforBolgeArac as $adminSoforBolgeAracc) {
                                     $digerSoforArac[$d]['DigerSoforAracID'] = $adminSoforBolgeAracc['SBAracID'];
                                     $digerSoforArac[$d]['DigerSoforAracPlaka'] = $adminSoforBolgeAracc['SBAracPlaka'];
                                     $d++;
                                 }
                             }
                         } else {
                             //seçili olan bölge
                             $soforbolgedizim = implode(',', $soforbolgeId);
                             //adamın seçili olab bölgedeki diğer araçları
                             $adminSoforBolgeArac = $Panel_Model->adminSelectBolgeArac($rutbebolgedizi);
                             $d = 0;
                             foreach ($adminSoforBolgeArac as $adminSoforBolgeAracc) {
                                 $digerSoforArac[$d]['DigerSoforAracID'] = $adminSoforBolgeAracc['SBAracID'];
                                 $digerSoforArac[$d]['DigerSoforAracPlaka'] = $adminSoforBolgeAracc['SBAracPlaka'];
                                 $d++;
                             }
                         }
                         //araç Özellikleri
                         $soforOzellik = $Panel_Model->soforDetail($soforDetailID);
                         $e = 0;
                         foreach ($soforOzellik as $soforOzellikk) {
                             $soforList[$e]['SoforListID'] = $soforOzellikk['BSSoforID'];
                             $soforList[$e]['SoforListAd'] = $soforOzellikk['BSSoforAd'];
                             $soforList[$e]['SoforListSoyad'] = $soforOzellikk['BSSoforSoyad'];
                             $soforList[$e]['SoforListTelefon'] = $soforOzellikk['BSSoforPhone'];
                             $soforList[$e]['SoforListMail'] = $soforOzellikk['BSSoforEmail'];
                             $soforList[$e]['SoforListLokasyon'] = $soforOzellikk['BSSoforLocation'];
                             $soforList[$e]['SoforListUlke'] = $soforOzellikk['BSSoforUlke'];
                             $soforList[$e]['SoforListIl'] = $soforOzellikk['BSSoforIl'];
                             $soforList[$e]['SoforListIlce'] = $soforOzellikk['BSSoforIlce'];
                             $soforList[$e]['SoforListSemt'] = $soforOzellikk['BSSoforSemt'];
                             $soforList[$e]['SoforListMahalle'] = $soforOzellikk['BSSoforMahalle'];
                             $soforList[$e]['SoforListSokak'] = $soforOzellikk['BSSoforSokak'];
                             $soforList[$e]['SoforListPostaKodu'] = $soforOzellikk['BSSoforPostaKodu'];
                             $soforList[$e]['SoforListCaddeNo'] = $soforOzellikk['BSSoforCaddeNo'];
                             $soforList[$e]['SoforListAdres'] = $soforOzellikk['BSSoforAdres'];
                             $soforList[$e]['SoforListDetayAdres'] = $soforOzellikk['BSSoforDetayAdres'];
                             $soforList[$e]['SoforListDurum'] = $soforOzellikk['Status'];
                             $soforList[$e]['SoforListAciklama'] = $soforOzellikk['BSSoforAciklama'];
                             $e++;
                         }
                     }
                     //sonuçlar
                     $sonuc["soforSelectBolge"] = $selectSoforBolge;
                     $sonuc["soforBolge"] = $digerSoforBolge;
                     $sonuc["soforSelectArac"] = $selectSoforArac;
                     $sonuc["soforArac"] = $digerSoforArac;
                     $sonuc["soforDetail"] = $soforList;
                 }
                 break;
             case "soforDetailDelete":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $form->post('sofordetail_id', true);
                     $soforDetailID = $form->values['sofordetail_id'];
                     $deleteresult = $Panel_Model->detailSoforDelete($soforDetailID);
                     if ($deleteresult) {
                         $deleteresultt = $Panel_Model->detailSoforAracDelete($soforDetailID);
                         if ($deleteresultt) {
                             $deleteresulttt = $Panel_Model->detailSoforBolgeDelete($soforDetailID);
                             if ($deleteresulttt) {
                                 $sonuc["delete"] = $languagedeger['SoforSil'];
                             }
                         } else {
                             $deleteresulttt = $Panel_Model->detailSoforBolgeDelete($soforDetailID);
                             if ($deleteresulttt) {
                                 $sonuc["delete"] = $languagedeger['SoforSil'];
                             }
                         }
                     } else {
                         $sonuc["hata"] = $languagedeger['Hata'];
                     }
                 }
                 $sonuc["soforDetail"] = $data["soforDetail"];
                 break;
             case "soforDetailKaydet":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $form->post('sofordetail_id', true);
                     $soforID = $form->values['sofordetail_id'];
                     $form->post('soforDetayAd', true);
                     $form->post('soforDetaySoyad', true);
                     $form->post('soforDetayEmail', true);
                     $form->post('soforDetayDurum', true);
                     $form->post('soforDetayLokasyon', true);
                     $form->post('soforDetayTelefon', true);
                     $form->post('soforDetayAdres', true);
                     $form->post('soforDetayAciklama', true);
                     $form->post('soforDetayUlke', true);
                     $form->post('soforDetayIl', true);
                     $form->post('soforDetayIlce', true);
                     $form->post('soforDetaySemt', true);
                     $form->post('soforDetayMahalle', true);
                     $form->post('soforDetaySokak', true);
                     $form->post('soforDetayPostaKodu', true);
                     $form->post('soforDetayCaddeNo', true);
                     $form->post('detayAdres', true);
                     $form->post('eskiAd', true);
                     $form->post('eskiSoyad', true);
                     $eskiAd = $form->values['eskiAd'];
                     $eskiSoyad = $form->values['eskiSoyad'];
                     $soforEmail = $form->values['soforEmail'];
                     $soforAd = $form->values['soforDetayAd'];
                     $soforSoyad = $form->values['soforDetaySoyad'];
                     $soforAdSoyad = $soforAd . ' ' . $soforSoyad;
                     $soforBolgeID = $_REQUEST['soforBolgeID'];
                     $soforBolgeAdi = $_REQUEST['soforBolgeAd'];
                     $soforAracID = $_REQUEST['soforAracID'];
                     $soforAracPlaka = $_REQUEST['soforAracPlaka'];
                     if (!filter_var($soforEmail, FILTER_VALIDATE_EMAIL) === false) {
                         $emailValidate = $form->mailControl1($soforEmail);
                         if ($emailValidate == 1) {
                             $kullaniciliste = $Panel_Model->soforEmailDbKontrol($soforEmail);
                             if (count($kullaniciliste) <= 0) {
                                 if ($form->submit()) {
                                     $data = array('BSSoforAd' => $soforAd, 'BSSoforSoyad' => $soforSoyad, 'BSSoforPhone' => $form->values['soforDetayTelefon'], 'BSSoforEmail' => $soforEmail, 'BSSoforLocation' => $form->values['soforDetayLokasyon'], 'BSSoforUlke' => $form->values['soforDetayUlke'], 'BSSoforIl' => $form->values['soforDetayIl'], 'BSSoforIlce' => $form->values['soforDetayIlce'], 'BSSoforSemt' => $form->values['soforDetaySemt'], 'BSSoforMahalle' => $form->values['soforDetayMahalle'], 'BSSoforSokak' => $form->values['soforDetaySokak'], 'BSSoforPostaKodu' => $form->values['soforDetayPostaKodu'], 'BSSoforCaddeNo' => $form->values['soforDetayCaddeNo'], 'BSSoforAdres' => $form->values['soforDetayAdres'], 'BSSoforDetayAdres' => $form->values['detayAdres'], 'BSSoforAciklama' => $form->values['soforDetayAciklama'], 'Status' => $form->values['soforDetayDurum']);
                                 }
                                 $resultSoforUpdate = $Panel_Model->soforOzelliklerDuzenle($data, $soforID);
                                 if ($resultSoforUpdate) {
                                     if ($soforAd != $eskiAd || $soforSoyad != $eskiSoyad) {
                                         $dataDuzenle = array('BSTurSoforAd' => $soforAdSoyad);
                                         $updatetur = $Panel_Model->soforOzelliklerDuzenle1($dataDuzenle, $soforID);
                                         $dataDuzenle2 = array('BSGonderenAdSoyad' => $soforAdSoyad);
                                         $updateduyuru = $Panel_Model->soforOzelliklerDuzenle4($dataDuzenle2, $soforID);
                                         $dataDuzenle3 = array('BSEkleyenAdSoyad' => $soforAdSoyad);
                                         $updateduyurulog = $Panel_Model->soforOzelliklerDuzenle5($dataDuzenle3, $soforID);
                                     }
                                     $aracID = count($soforAracID);
                                     if ($aracID > 0) {
                                         $deleteresultt = $Panel_Model->adminSoforAracDelete($soforID);
                                         for ($a = 0; $a < $aracID; $a++) {
                                             $sofordata[$a] = array('BSAracID' => $soforAracID[$a], 'BSAracPlaka' => $soforAracPlaka[$a], 'BSSoforID' => $soforID, 'BSSoforAd' => $soforAdSoyad);
                                         }
                                         $resultSoforUpdate = $Panel_Model->addNewSoforArac($sofordata);
                                         if ($resultSoforUpdate) {
                                             $bolgeID = count($soforBolgeID);
                                             $deleteresulttt = $Panel_Model->adminDetailSoforBolgeDelete($bolgeID);
                                             if ($deleteresulttt) {
                                                 for ($b = 0; $b < $bolgeID; $b++) {
                                                     $bolgedata[$b] = array('BSSoforID' => $soforID, 'BSSoforAd' => $soforAdSoyad, 'BSBolgeID' => $soforBolgeID[$b], 'BSBolgeAdi' => $soforBolgeAdi[$b]);
                                                 }
                                                 $resultBolgeID = $Panel_Model->addNewSoforBolge($bolgedata);
                                                 if ($resultBolgeID) {
                                                     $sonuc["newSoforID"] = $soforID;
                                                     $sonuc["update"] = $languagedeger['SoforDuzenle'];
                                                 } else {
                                                     $sonuc["hata"] = $languagedeger['Hata'];
                                                 }
                                             } else {
                                                 $sonuc["hata"] = $languagedeger['Hata'];
                                             }
                                         } else {
                                             $sonuc["hata"] = $languagedeger['Hata'];
                                         }
                                     } else {
                                         $deleteresultt = $Panel_Model->adminSoforAracDelete($soforID);
                                         $deleteresulttt = $Panel_Model->adminDetailSoforBolgeDelete($soforID);
                                         if ($deleteresulttt) {
                                             $bolgeID = count($soforBolgeID);
                                             for ($b = 0; $b < $bolgeID; $b++) {
                                                 $bolgedata[$b] = array('BSSoforID' => $soforID, 'BSSoforAd' => $soforAdSoyad, 'BSBolgeID' => $soforBolgeID[$b], 'BSBolgeAdi' => $soforBolgeAdi[$b]);
                                             }
                                             $resultBolgeID = $Panel_Model->addNewSoforBolge($bolgedata);
                                             if ($resultBolgeID) {
                                                 $sonuc["newSoforID"] = $soforID;
                                                 $sonuc["update"] = $languagedeger['SoforDuzenle'];
                                             } else {
                                                 $sonuc["hata"] = $languagedeger['Hata'];
                                             }
                                         } else {
                                             $sonuc["hata"] = $languagedeger['Hata'];
                                         }
                                     }
                                 } else {
                                     $sonuc["hata"] = $languagedeger['Hata'];
                                 }
                             } else {
                                 $sonuc["hata"] = $languagedeger['KullanilmisEmail'];
                             }
                         } else {
                             $sonuc["hata"] = $languagedeger['BaskaEmail'];
                         }
                     } else {
                         $sonuc["hata"] = $languagedeger['GecerliEmail'];
                     }
                 }
             case "SoforDetailMultiSelect":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $soforDetailBolgeID = $_REQUEST['soforDetailBolgeID'];
                     $form->post('soforID', true);
                     $soforID = $form->values['soforID'];
                     //şoföre ait araçlar
                     $adminSoforArac = $Panel_Model->soforDetailMultiSelectSofor($soforID);
                     if (count($adminSoforArac) > 0) {
                         $soforaracId = [];
                         foreach ($adminSoforArac as $adminSoforAracc) {
                             $soforaracId[] = $adminSoforAracc['BSAracID'];
                         }
                         //şoföre ait araçlar
                         $soforbolgearac = implode(',', $soforaracId);
                         //seçilen bölgeler
                         $soforbolgedizim = implode(',', $soforDetailBolgeID);
                         //seçilen bölgedeki araçlar
                         $SoforBolgeArac = $Panel_Model->adminSelectBolgeAracc($soforbolgedizim);
                         $soforDigerAracId = [];
                         foreach ($SoforBolgeArac as $SoforBolgeAracc) {
                             $soforDigerAracId[] = $SoforBolgeAracc['SBAracID'];
                         }
                         //gelen arac ıdlerinde aynı olan idler, seçili araçlardır.
                         $ortakIDler = array_intersect($soforaracId, $soforDigerAracId);
                         //gelen idlerde ki farklı olanlar seçili olmayan araçlardır yani diğer araçlar
                         $arac_fark = array_diff($soforDigerAracId, $soforaracId);
                         $diger_arac_fark = implode(',', $arac_fark);
                         //ortak ıd ye sahip arac varmı
                         if (count($ortakIDler) > 0) {
                             //seçili araçlar
                             $secilenIdArac = implode(',', $ortakIDler);
                             $selectBolgeArac = $Panel_Model->soforNotSelectArac($secilenIdArac);
                             $c = 0;
                             foreach ($selectBolgeArac as $selectBolgeAracc) {
                                 $selectSoforArac[$c]['SelectSoforAracID'] = $selectBolgeAracc['SBAracID'];
                                 $selectSoforArac[$c]['SelectSoforAracPlaka'] = $selectBolgeAracc['SBAracPlaka'];
                                 $c++;
                             }
                             //diğer şoförler
                             $digerBolgeArac = $Panel_Model->soforNotSelectArac($diger_arac_fark);
                             $d = 0;
                             foreach ($digerBolgeArac as $digerBolgeAracc) {
                                 $digerSoforArac[$d]['DigerSoforAracID'] = $digerBolgeAracc['SBAracID'];
                                 $digerSoforArac[$d]['DigerSoforAracPlaka'] = $digerBolgeAracc['SBAracPlaka'];
                                 $d++;
                             }
                         } else {
                             //ortak id yoksa seçili şoför yoktur
                             //diğer şoförler
                             $digerBolgeArac = $Panel_Model->soforNotSelectArac($diger_arac_fark);
                             $d = 0;
                             foreach ($digerBolgeArac as $digerBolgeAracc) {
                                 $digerSoforArac[$d]['DigerSoforAracID'] = $digerBolgeAracc['SBAracID'];
                                 $digerSoforArac[$d]['DigerSoforAracPlaka'] = $digerBolgeAracc['SBAracPlaka'];
                                 $d++;
                             }
                         }
                     } else {
                         $soforDetailBollgeID = implode(',', $soforDetailBolgeID);
                         //adamın seçili olab bölgedeki diğer şoförleri
                         $adminAracBolgeSofor = $Panel_Model->adminSelectBolgeAracc($soforDetailBollgeID);
                         $d = 0;
                         foreach ($adminAracBolgeSofor as $adminAracBolgeSoforr) {
                             $digerSoforArac[$d]['DigerSoforAracID'] = $adminAracBolgeSoforr['SBAracID'];
                             $digerSoforArac[$d]['DigerSoforAracPlaka'] = $adminAracBolgeSoforr['SBAracPlaka'];
                             $d++;
                         }
                     }
                     //sonuçlar
                     $sonuc["adminSoforSelectArac"] = $selectSoforArac;
                     $sonuc["adminSoforArac"] = $digerSoforArac;
                 }
                 break;
             case "soforDetailTur":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $form->post('soforID', true);
                     $sID = $form->values['soforID'];
                     $soforTurDetail = $Panel_Model->adminSoforTurDetail($sID);
                     //arac TUR İD
                     $a = 0;
                     foreach ($soforTurDetail as $soforTurDetaill) {
                         $soforturId[] = $soforTurDetaill['BSTurID'];
                         $a++;
                     }
                     $turId = implode(',', $soforturId);
                     $soforTur = $Panel_Model->adminSoforDetailTur($turId);
                     $b = 0;
                     foreach ($soforTur as $soforTurr) {
                         $soforDetailTur[$b]['TurID'] = $soforTurr['SBTurID'];
                         $soforDetailTur[$b]['TurAd'] = $soforTurr['SBTurAd'];
                         $soforDetailTur[$b]['TurAciklama'] = $soforTurr['SBTurAciklama'];
                         $soforDetailTur[$b]['TurAktiflik'] = $soforTurr['SBTurAktiflik'];
                         $soforDetailTur[$b]['TurKurum'] = $soforTurr['SBKurumAd'];
                         $soforDetailTur[$b]['TurTip'] = $soforTurr['SBTurTip'];
                         $soforDetailTur[$b]['TurBolge'] = $soforTurr['SBBolgeAd'];
                         $b++;
                     }
                     $sonuc["soforDetailTur"] = $soforDetailTur;
                 }
                 break;
             case "adminSoforTakvim":
                 $calendar = $this->load->otherClasses('Calendar');
                 // Short-circuit if the client did not give us a date range.
                 if (!isset($_POST['start']) || !isset($_POST['end'])) {
                     error_log("die");
                     die("Please provide a date range.");
                 }
                 // Parse the start/end parameters.
                 // These are assumed to be ISO8601 strings with no time nor timezone, like "2013-12-29".
                 // Since no timezone will be present, they will parsed as UTC.
                 $range_start = parseDateTime($_POST['start']);
                 $range_end = parseDateTime($_POST['end']);
                 // Parse the timezone parameter if it is present.
                 $timezone = null;
                 if (isset($_POST['timezone'])) {
                     $timezone = new DateTimeZone($_POST['timezone']);
                 }
                 $form->post("id", true);
                 $id = $form->values['id'];
                 $adminSoforTakvim = $Panel_Model->adminSoforTakvim($id);
                 $a = 0;
                 foreach ($adminSoforTakvim as $adminSoforTakvimm) {
                     $tkvimID[$a] = $adminSoforTakvimm['BSTurID'];
                     $soforTkvim[$a]['Pzt'] = $adminSoforTakvimm['SBTurPzt'];
                     $soforTkvim[$a]['Sli'] = $adminSoforTakvimm['SBTurSli'];
                     $soforTkvim[$a]['Crs'] = $adminSoforTakvimm['SBTurCrs'];
                     $soforTkvim[$a]['Prs'] = $adminSoforTakvimm['SBTurPrs'];
                     $soforTkvim[$a]['Cma'] = $adminSoforTakvimm['SBTurCma'];
                     $soforTkvim[$a]['Cmt'] = $adminSoforTakvimm['SBTurCmt'];
                     $soforTkvim[$a]['Pzr'] = $adminSoforTakvimm['SBTurPzr'];
                     $soforTkvim[$a]['Bslngc'] = $adminSoforTakvimm['BSTurBslngc'];
                     $soforTkvim[$a]['Bts'] = $adminSoforTakvimm['BSTurBts'];
                     $a++;
                 }
                 $count = count($tkvimID);
                 foreach ($tkvimID as $value) {
                     $sql .= 'SELECT SBTurAd FROM sbtur WHERE SBTurID=' . $value . ' UNION ALL ';
                 }
                 $uzunluk = strlen($sql);
                 $uzunluk = $uzunluk - 10;
                 $sqlTitle = substr($sql, 0, $uzunluk);
                 $takvimTitle = $Panel_Model->takvimTitle($sqlTitle);
                 $c = 0;
                 foreach ($takvimTitle as $takvimTitlee) {
                     $title[$c] = $takvimTitlee['SBTurAd'];
                     $c++;
                 }
                 $input_arrays = [];
                 $input_arrays = $form->calendar($soforTkvim, $title);
                 $sonuc = $input_arrays;
                 break;
             default:
                 header("Location:" . SITE_URL_LOGOUT);
                 break;
         }
         echo json_encode($sonuc);
     } else {
         header("Location:" . SITE_URL_LOGOUT);
     }
 }
    public function _getHTML()
    {
        $this->loadLastChange();
        $this->loadModules();
        $self = basename($_SERVER['PHP_SELF']);
        $qs = $this->menu_item ? "?mi={$this->menu_item}" : '';
        $html = <<<EOT
<form action="{$self}{$qs}" method="post">
\t<h2>WWW module - [Liste]</h2>
\t<div class="levyV">

EOT;
        if ($this->lastchange != null) {
            $html .= <<<EOT
\t\t<div class="zmena">Zuletzt Aktualisiert: {$this->lastchange->format()}</div>

EOT;
        }
        $disabled_str = sizeof($this->modules) == 0 || $this->read_only ? ' disabled' : '';
        $all_checked_str = $this->all_checked ? ' checked' : '';
        $html .= <<<EOT
\t\t<div id="frame">
\t\t\t<table class="tab-seznam" cellspacing="0" cellpadding="0">
\t\t\t\t<tr>
\t\t\t\t\t<th><input type="checkbox" name="checkall" value="Vsechny"{$disabled_str} onclick="checkUncheckAll(document.getElementsByName('check[]'),this);Kiwi_Modules_Form.enableBtns(false);"{$all_checked_str} /></th>
\t\t\t\t\t<th>Bezeichnung</th>
\t\t\t\t\t<th>Modultyp</th>
\t\t\t\t\t<th>Nutzung</th>
\t\t\t\t\t<th>geändert</th>
\t\t\t\t\t<th>aktiv</th>
\t\t\t\t</tr>

EOT;
        $sw = 1;
        $next_sw = array(1 => 2, 2 => 1);
        $i = 0;
        foreach ($this->modules as $module) {
            $i++;
            $checked_str = isset($this->checked[$module->ID]) && $this->checked[$module->ID] ? ' checked' : '';
            $disabled_str = $this->read_only ? ' disabled' : '';
            $name = htmlspecialchars($module->Name);
            $mlink = KIWI_EDIT_MODULE . "?m={$module->ID}";
            if ($this->menu_item) {
                $mlink .= "&smi={$this->menu_item}";
            }
            // kvůli korektnímu návratu po editaci modulu ze seznamu modulů
            $mtype = htmlspecialchars($GLOBALS['module_types'][$module->Type][0]);
            if ($module->Usage) {
                $usage = $module->Usage;
                if ($module->Usage > $module->ActiveUsage) {
                    $aktivni = 'aktivní';
                    if ($module->ActiveUsage > 4) {
                        $aktivni .= 'ch';
                    }
                    $usage .= " ({$module->ActiveUsage} {$aktivni})";
                }
            } else {
                $usage = '0';
            }
            $dt = parseDateTime($module->LastChange);
            $lastchange = date('j.n.Y H:i', $dt['stamp']);
            $active = $module->Active != 0 ? 'ja' : 'nein';
            $html .= <<<EOT
\t\t\t\t<tr class="t-s-{$sw}">
\t\t\t\t\t<td><input type="checkbox" name="check[]" value="{$module->ID}" onclick="Kiwi_Modules_Form.enableBtns(this.checked);"{$disabled_str}{$checked_str} /></td>
\t\t\t\t\t<td><a href="{$mlink}">{$name}</a></td>
\t\t\t\t\t<td>{$mtype}</td>
\t\t\t\t\t<td>{$usage}</td>
\t\t\t\t\t<td>{$lastchange}</td>

EOT;
            if (!$this->read_only) {
                $html .= <<<EOT
\t\t\t\t\t<td><a href="{$self}?as={$module->ID}">{$active}</a></td>

EOT;
            } else {
                $html .= <<<EOT
\t\t\t\t\t<td>{$active}</td>

EOT;
            }
            $html .= <<<EOT
\t\t\t\t</tr>

EOT;
            $sw = $next_sw[$sw];
        }
        if (sizeof($this->checked) == 0 || $this->read_only) {
            $disabled_str = ' disabled';
            $but_class = 'but3D';
        } else {
            $disabled_str = '';
            $but_class = 'but3';
        }
        if ($this->read_only) {
            $disabled_str2 = ' disabled';
            $but_class2 = 'but3D';
        } else {
            $disabled_str2 = '';
            $but_class2 = 'but3';
        }
        $html .= <<<EOT
\t\t\t</table>
\t\t</div>
\t</div>
\t<div class="form2">
\t\t<fieldset>

EOT;
        if ($this->menu_item) {
            $html .= <<<EOT
\t\t\t<input type="submit" id="kmofc_cmd5" name="cmd" value="zufügen" class="{$but_class}"{$disabled_str} />

EOT;
        } else {
            $html .= <<<EOT
\t\t\t<input type="submit" id="kmofc_cmd1" name="cmd" value="Modul hinzufügen:" class="{$but_class2}"{$disabled_str2} />
\t\t\t<select name="kmofc_modules" class="sel1"{$disabled_str2}>

EOT;
            foreach ($GLOBALS['module_types'] as $mk => $mt) {
                $html .= <<<EOT
\t\t\t\t<option value="{$mk}">{$mt[0]}</option>

EOT;
            }
            $html .= <<<EOT
\t\t\t</select>

EOT;
        }
        $html .= <<<EOT
\t\t\t<input type="submit" id="kmofc_cmd2" name="cmd" value="entfernen" class="{$but_class}"{$disabled_str} onclick="return Kiwi_Modules_Form.onDelete()" />
\t\t\t<input type="submit" id="kmofc_cmd3" name="cmd" value="aktivieren" class="{$but_class}"{$disabled_str} />
\t\t\t<input type="submit" id="kmofc_cmd4" name="cmd" value="deaktivieren" class="{$but_class}"{$disabled_str} />
\t\t</fieldset>
\t</div>
</form>

EOT;
        return $html;
    }
Exemple #23
0
 public function adminAjaxSorgu()
 {
     //session güvenlik kontrolü
     $form = $this->load->otherClasses('Form');
     $sessionKey = $form->sessionKontrol();
     $adSoyad = Session::get("kullaniciad") . ' ' . Session::get("kullanicisoyad");
     $bolgeIcon = 'fa fa-th';
     $bolgeUrl = 'bolgeliste';
     if ($_POST && $_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest" && Session::get("BSShuttlelogin") == true && Session::get("sessionkey") == $sessionKey && Session::get("selectFirmaDurum") != 0) {
         //dil yapılandırılması
         $lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
         if (!Session::get("dil")) {
             Session::set("dil", $lang);
             $formm = $this->load->ajaxlanguage($lang);
             $deger = $formm->ajaxlanguage();
             $degerbildirim = $formm->bildirimlanguage();
         } else {
             $formm = $this->load->ajaxlanguage(Session::get("dil"));
             $deger = $formm->ajaxlanguage();
             $degerbildirim = $formm->bildirimlanguage();
         }
         $sonuc = array();
         //model bağlantısı
         $Panel_Model = $this->load->model("Panel_Model");
         //form class bağlanısı
         $MemcacheModel = $this->load->model("AdminMemcache_Model");
         $form->post("tip", true);
         $tip = $form->values['tip'];
         switch ($tip) {
             case "adminAracEkleSelect":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $adminRutbe = Session::get("userRutbe");
                     //super adminse tüm bölgeler çekilir
                     if ($adminRutbe != 0) {
                         //bölgeleri getirir
                         $bolgeListe = $Panel_Model->aracBolgeListele();
                         $a = 0;
                         foreach ($bolgeListe as $bolgelist) {
                             $adminBolge['AdminBolge'][$a] = $bolgelist['SBBolgeAdi'];
                             $adminBolge['AdminBolgeID'][$a] = $bolgelist['SBBolgeID'];
                             $a++;
                         }
                     } else {
                         //değilse admin ıd ye göre bölge görür
                         $bolgeListeRutbe = $Panel_Model->adminAracBolgeListele($adminID);
                         foreach ($bolgeListeRutbe as $rutbe) {
                             $bolgerutbeId[] = $rutbe['BSBolgeID'];
                         }
                         $rutbebolgedizi = implode(',', $bolgerutbeId);
                         //rütbeye göre bölge listele
                         $bolgeListe = $Panel_Model->adminRutbeAracBolgeListele($rutbebolgedizi);
                         $a = 0;
                         foreach ($bolgeListe as $bolgelist) {
                             $adminBolge['AdminBolge'][$a] = $bolgelist['SBBolgeAdi'];
                             $adminBolge['AdminBolgeID'][$a] = $bolgelist['SBBolgeID'];
                             $a++;
                         }
                     }
                     $sonuc["adminAracBolge"] = $adminBolge;
                 }
                 break;
                 break;
             case "adminAracKaydet":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $adminRutbe = Session::get("userRutbe");
                     $form->post('aracPlaka', true);
                     $form->post('aracMarka', true);
                     $form->post('aracModelYil', true);
                     $form->post('aracKapasite', true);
                     $form->post('aracKm', true);
                     $form->post('aracAciklama', true);
                     $form->post('aracDurum', true);
                     $aracPlak = $form->values['aracPlaka'];
                     $aracPlaka = strtoupper($aracPlak);
                     $aracSoforID = $_REQUEST['aracSoforID'];
                     $aracSoforAd = $_REQUEST['aracSoforAd'];
                     $aracHostesID = $_REQUEST['aracHostesID'];
                     $aracHostesAd = $_REQUEST['aracHostesAd'];
                     $aracBolgeAd = $_REQUEST['aracBolgeAd'];
                     $aracBolgeID = $_REQUEST['aracBolgeID'];
                     $aracListe = $Panel_Model->aracListeleCount();
                     $aracCount = $aracListe[0]['COUNT(*)'];
                     $Panel_Model_Our = $this->load->model("Panel_Model_Our");
                     $loginfirmaID = Session::get("FirmaId");
                     $rootDbFirmaArac = $Panel_Model_Our->rootFirmaAracCount($loginfirmaID);
                     $firmAracCount = $rootDbFirmaArac[0]["rootfirmaAracSayi"];
                     if ($aracCount <= $firmAracCount) {
                         if ($form->submit()) {
                             $data = array('SBAracMarka' => $form->values['aracMarka'], 'SBAracModelYili' => $form->values['aracModelYil'], 'SBAracPlaka' => $aracPlaka, 'SBAracKapasite' => $form->values['aracKapasite'], 'SBAracKm' => $form->values['aracKm'], 'SBAracAciklama' => $form->values['aracAciklama'], 'SBAracDurum' => $form->values['aracDurum']);
                         }
                         $resultAracID = $Panel_Model->addNewAdminArac($data);
                         if ($resultAracID) {
                             $soforID = count($aracSoforID);
                             $hostesID = count($aracHostesID);
                             if ($soforID > 0) {
                                 for ($a = 0; $a < $soforID; $a++) {
                                     $sofordata[$a] = array('BSAracID' => $resultAracID, 'BSAracPlaka' => $aracPlaka, 'BSSoforID' => $aracSoforID[$a], 'BSSoforAd' => $aracSoforAd[$a]);
                                 }
                                 $resultSoforID = $Panel_Model->addNewAdminAracSofor($sofordata);
                                 if ($resultSoforID) {
                                     if ($hostesID > 0) {
                                         for ($h = 0; $h < $soforID; $h++) {
                                             $hostesdata[$h] = array('BSAracID' => $resultAracID, 'BSAracPlaka' => $aracPlaka, 'BSHostesID' => $aracHostesID[$h], 'BSHostesAd' => $aracHostesAd[$h]);
                                         }
                                         $resultHostesID = $Panel_Model->addNewAdminAracHostes($hostesdata);
                                     }
                                     $bolgeID = count($aracBolgeID);
                                     for ($b = 0; $b < $bolgeID; $b++) {
                                         $bolgedata[$b] = array('SBAracID' => $resultAracID, 'SBAracPlaka' => $aracPlaka, 'SBBolgeID' => $aracBolgeID[$b], 'SBBolgeAdi' => $aracBolgeAd[$b]);
                                     }
                                     $resultBolgeID = $Panel_Model->addNewAdminBolgeSofor($bolgedata);
                                     if ($resultBolgeID) {
                                         if ($aracSoforID) {
                                             //şoföre bildirim gönderme
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracAtama"];
                                             $resultSoforCihaz = $Panel_Model->soforCihaz($aracSoforID);
                                             if (count($resultSoforCihaz) > 0) {
                                                 foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                     $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                                 }
                                                 $soforCihazlar = implode(',', $soforCihaz);
                                                 $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracAta"]);
                                             }
                                         }
                                         //hostes varsa
                                         if ($aracHostesID) {
                                             //hostese bildirim gönderme
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracAtama"];
                                             $resultHostesCihaz = $Panel_Model->hostesCihaz($aracHostesID);
                                             if (count($resultHostesCihaz) > 0) {
                                                 foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                     $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                                 }
                                                 $hostesCihazlar = implode(',', $hostesCihaz);
                                                 $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracAta"]);
                                             }
                                         }
                                         $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracEkleme"];
                                         $aracRenk = 'success';
                                         $aracUrl = 'aracliste';
                                         $aracIcon = 'fa fa-bus';
                                         //bildirim ayarları
                                         if ($adminRutbe != 1) {
                                             //normal admin
                                             $adminBolgeler = implode(',', $aracBolgeID);
                                             $adminIDLer = array(1, $adminID);
                                             $adminImplodeID = implode(',', $adminIDLer);
                                             $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($adminBolgeler, $adminImplodeID);
                                             $adminBolgeCount = count($resultAdminBolgeler);
                                             if ($adminBolgeCount > 0) {
                                                 //diğer adminler
                                                 $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 11);
                                                 for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                     $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 11);
                                                 }
                                                 $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                 if ($resultBildirim) {
                                                     $adminNotfIDLer = array(1, $adminImplodeID);
                                                     $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                     $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                     if (count($resultAdminCihaz) > 0) {
                                                         foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                             $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                         }
                                                         $adminCihaz = implode(',', $adminCihaz);
                                                         $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                     }
                                                 }
                                             } else {
                                                 $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 11);
                                                 $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                 if ($resultBildirim) {
                                                     $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                     if (count($resultAdminCihaz) > 0) {
                                                         foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                             $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                         }
                                                         $adminCihaz = implode(',', $adminCihaz);
                                                         $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                     }
                                                 }
                                             }
                                         } else {
                                             //üst admin
                                             $adminBolgeler = implode(',', $aracBolgeID);
                                             $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($adminBolgeler);
                                             $adminIDCount = count($resultBolgeAdminID);
                                             if ($adminIDCount > 0) {
                                                 for ($b = 0; $b < $adminIDCount; $b++) {
                                                     $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 11);
                                                 }
                                                 $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                 if ($resultBildirim) {
                                                     $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                     $adminNotfIDLer = array($adminImplodeID);
                                                     $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                     $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                     if (count($resultAdminCihaz) > 0) {
                                                         foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                             $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                         }
                                                         $adminCihaz = implode(',', $adminCihaz);
                                                         $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                     }
                                                 }
                                             }
                                         }
                                         //log ayarları
                                         $dataLog = $form->adminBildirimLogDuzen($adminID, $adSoyad, $alert);
                                         $resultLog = $Panel_Model->addNewAdminBildirimLog($dataLog);
                                         if ($resultLog) {
                                             $sonuc["newAracID"] = $resultAracID;
                                             $sonuc["insert"] = $degerbildirim["AracKaydet"];
                                         } else {
                                             $sonuc["hata"] = $deger["Hata"];
                                         }
                                     } else {
                                         //arac şofor kaydedilirken bi hata meydana geldi ise
                                         $deleteresult = $Panel_Model->adminAracDelete($resultAracID);
                                         $deleteresultt = $Panel_Model->adminAracSoforDelete($resultAracID);
                                         $deleteresulttt = $Panel_Model->adminAracHostesDelete($resultAracID);
                                         //arac şofmr kaydedilirken bi hata meydana geldi ise
                                         if ($deleteresultt) {
                                             $sonuc["hata"] = $deger["Hata"];
                                         }
                                     }
                                 } else {
                                     $deleteresult = $Panel_Model->adminAracDelete($resultAracID);
                                     //arac şofmr kaydedilirken bi hata meydana geldi ise
                                     if ($deleteresult) {
                                         $sonuc["hata"] = $deger["Hata"];
                                     }
                                 }
                             } else {
                                 if ($hostesID > 0) {
                                     for ($h = 0; $h < $soforID; $h++) {
                                         $hostesdata[$h] = array('BSAracID' => $resultAracID, 'BSAracPlaka' => $aracPlaka, 'BSHostesID' => $aracHostesID[$h], 'BSHostesAd' => $aracHostesAd[$h]);
                                     }
                                     $resultHostesID = $Panel_Model->addNewAdminAracHostes($hostesdata);
                                 }
                                 $bolgeID = count($aracBolgeID);
                                 for ($b = 0; $b < $bolgeID; $b++) {
                                     $bolgedata[$b] = array('SBAracID' => $resultAracID, 'SBAracPlaka' => $aracPlaka, 'SBBolgeID' => $aracBolgeID[$b], 'SBBolgeAdi' => $aracBolgeAd[$b]);
                                 }
                                 $resultBolgeID = $Panel_Model->addNewAdminBolgeSofor($bolgedata);
                                 if ($resultBolgeID) {
                                     if ($aracSoforID) {
                                         //şoföre bildirim gönderme
                                         $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracAtama"];
                                         $resultSoforCihaz = $Panel_Model->soforCihaz($aracSoforID);
                                         if (count($resultSoforCihaz) > 0) {
                                             foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                 $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                             }
                                             $soforCihazlar = implode(',', $soforCihaz);
                                             $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracAta"]);
                                         }
                                     }
                                     //hostes varsa
                                     if ($aracHostesID) {
                                         //hostese bildirim gönderme
                                         $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracAtama"];
                                         $resultHostesCihaz = $Panel_Model->hostesCihaz($aracHostesID);
                                         if (count($resultHostesCihaz) > 0) {
                                             foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                 $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                             }
                                             $hostesCihazlar = implode(',', $hostesCihaz);
                                             $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracAta"]);
                                         }
                                     }
                                     $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracEkleme"];
                                     $aracRenk = 'success';
                                     $aracUrl = 'aracliste';
                                     $aracIcon = 'fa fa-bus';
                                     //bildirim ayarları
                                     if ($adminRutbe != 1) {
                                         //normal admin
                                         $adminBolgeler = implode(',', $aracBolgeID);
                                         $adminIDLer = array(1, $adminID);
                                         $adminImplodeID = implode(',', $adminIDLer);
                                         $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($adminBolgeler, $adminImplodeID);
                                         $adminBolgeCount = count($resultAdminBolgeler);
                                         if ($adminBolgeCount > 0) {
                                             //diğer adminler
                                             $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 11);
                                             for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                 $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 11);
                                             }
                                             $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                             if ($resultBildirim) {
                                                 $adminNotfIDLer = array(1, $adminImplodeID);
                                                 $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                 $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                 if (count($resultAdminCihaz) > 0) {
                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                     }
                                                     $adminCihaz = implode(',', $adminCihaz);
                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                 }
                                             }
                                         } else {
                                             $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 11);
                                             $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                             if ($resultBildirim) {
                                                 $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                 if (count($resultAdminCihaz) > 0) {
                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                     }
                                                     $adminCihaz = implode(',', $adminCihaz);
                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                 }
                                             }
                                         }
                                     } else {
                                         //üst admin
                                         $adminBolgeler = implode(',', $aracBolgeID);
                                         $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($adminBolgeler);
                                         $adminIDCount = count($resultBolgeAdminID);
                                         if ($adminIDCount > 0) {
                                             for ($b = 0; $b < $adminIDCount; $b++) {
                                                 $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 11);
                                             }
                                             $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                             if ($resultBildirim) {
                                                 $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                 $adminNotfIDLer = array($adminImplodeID);
                                                 $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                 $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                 if (count($resultAdminCihaz) > 0) {
                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                     }
                                                     $adminCihaz = implode(',', $adminCihaz);
                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                 }
                                             }
                                         }
                                     }
                                     //log ayarları
                                     $dataLog = $form->adminBildirimLogDuzen($adminID, $adSoyad, $alert);
                                     $resultLog = $Panel_Model->addNewAdminBildirimLog($dataLog);
                                     if ($resultLog) {
                                         $sonuc["newAracID"] = $resultAracID;
                                         $sonuc["insert"] = $degerbildirim["AracKaydet"];
                                     } else {
                                         $sonuc["hata"] = $deger["Hata"];
                                     }
                                 } else {
                                     //arac şofor kaydedilirken bi hata meydana geldi ise
                                     $deleteresult = $Panel_Model->adminAracDelete($resultAracID);
                                     $deleteresultt = $Panel_Model->adminAracSoforDelete($resultAracID);
                                     $deleteresulttt = $Panel_Model->adminAracHostesDelete($resultAracID);
                                     //arac şofmr kaydedilirken bi hata meydana geldi ise
                                     if ($deleteresultt) {
                                         $sonuc["hata"] = $deger["Hata"];
                                     }
                                 }
                             }
                         } else {
                             $sonuc["hata"] = $deger["Hata"];
                         }
                     } else {
                         $sonuc["hata"] = $deger["AracEkleCount"];
                     }
                 }
                 break;
             case "adminAracDetail":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $adminRutbe = Session::get("userRutbe");
                     //superadminse
                     if ($adminRutbe != 0) {
                         $form->post('adminaracRowid', true);
                         $adminAracDetailID = $form->values['adminaracRowid'];
                         $adminAracBolge = $Panel_Model->adminDetailAracBolge($adminAracDetailID);
                         //arac bölge idler
                         $a = 0;
                         foreach ($adminAracBolge as $aracBolge) {
                             $selectAracBolge[$a]['SelectAracBolgeID'] = $aracBolge['SBBolgeID'];
                             $selectAracBolge[$a]['SelectAracBolgeAdi'] = $aracBolge['SBBolgeAdi'];
                             $aracbolgeId[] = $aracBolge['SBBolgeID'];
                             $a++;
                         }
                         //aracın turu var mı yokmu
                         $adminAracTur = $Panel_Model->adminDetailAracTur($adminAracDetailID);
                         //arac bölge idler
                         $z = 0;
                         foreach ($adminAracTur as $adminAracTurr) {
                             $selectAracTur[$z]['SelectAracTur'] = $adminAracTurr['SBTurAktiflik'];
                             $z++;
                         }
                         //araca ait bölge varmı(kesin oalcak arac a bölge seçtirmeden ekletmiyoruz
                         $aracCountBolge = count($aracbolgeId);
                         if ($aracCountBolge > 0) {
                             $aracbolgedizi = implode(',', $aracbolgeId);
                             //aracın bolgesi dışındakiler
                             $digerBolge = $Panel_Model->adminDetailAracSBolge($aracbolgedizi);
                             //arac diğer bölgeler
                             $b = 0;
                             foreach ($digerBolge as $digerBolgee) {
                                 $digerAracBolge[$b]['DigerAracBolgeID'] = $digerBolgee['SBBolgeID'];
                                 $digerAracBolge[$b]['DigerAracBolgeAdi'] = $digerBolgee['SBBolgeAdi'];
                                 $b++;
                             }
                         }
                         //admin araç seçili şoför
                         $adminAracSofor = $Panel_Model->adminDetailAracSofor($adminAracDetailID);
                         //admin araç hostes
                         $adminAracHostes = $Panel_Model->adminDetailAracHostes($adminAracDetailID);
                         $aracSoforCount = count($adminAracSofor);
                         $aracHostesCount = count($adminAracHostes);
                         //eğer aracın seçili şoförü varsa burası gelecek
                         if ($aracSoforCount > 0) {
                             if ($aracHostesCount > 0) {
                                 //arac Hostes idler
                                 $h = 0;
                                 foreach ($adminAracHostes as $adminAracHostess) {
                                     $selectAracHostes[$h]['SelectAracHostesID'] = $adminAracHostess['BSHostesID'];
                                     $selectAracHostes[$h]['SelectAracHostesAdi'] = $adminAracHostess['BSHostesAd'];
                                     $arachostesId[] = $adminAracHostess['BSHostesID'];
                                     $h++;
                                 }
                                 //seçili olan bölge
                                 $aracbolgedizim = implode(',', $aracbolgeId);
                                 //seöili olan hostes
                                 $aracbolgehostes = implode(',', $arachostesId);
                                 //adamın seçili olab bölgedeki diğer hostesleri
                                 $adminAracBolgeHostes = $Panel_Model->adminSelectBolgeHostes($aracbolgedizim, $aracbolgehostes);
                                 if (count($adminAracBolgeHostes) > 0) {
                                     $t = 0;
                                     foreach ($adminAracBolgeHostes as $adminAracBolgeHostess) {
                                         $digerAracHostes[$t]['DigerAracHostesID'] = $adminAracBolgeHostess['BSHostesID'];
                                         $digerAracHostes[$t]['DigerAracHostesAdi'] = $adminAracBolgeHostess['BSHostesAd'];
                                         $t++;
                                     }
                                 }
                             } else {
                                 //seçili olan bölge
                                 $aracbolgedizim = implode(',', $aracbolgeId);
                                 //adamın seçili olab bölgedeki diğer hostesi
                                 $adminAracBolgeHostes = $Panel_Model->adminSelectBolgeHostess($aracbolgedizim);
                                 $t = 0;
                                 foreach ($adminAracBolgeHostes as $adminAracBolgeHostess) {
                                     $digerAracHostes[$t]['DigerAracHostesID'] = $adminAracBolgeHostess['BSHostesID'];
                                     $digerAracHostes[$t]['DigerAracHostesAdi'] = $adminAracBolgeHostess['BSHostesAd'];
                                     $t++;
                                 }
                             }
                             //arac Şofor idler
                             $c = 0;
                             foreach ($adminAracSofor as $adminAracSoforr) {
                                 $selectAracSofor[$c]['SelectAracSoforID'] = $adminAracSoforr['BSSoforID'];
                                 $selectAracSofor[$c]['SelectAracSoforAdi'] = $adminAracSoforr['BSSoforAd'];
                                 $aracsoforId[] = $adminAracSoforr['BSSoforID'];
                                 $c++;
                             }
                             //seçili olan bölge
                             $aracbolgedizim = implode(',', $aracbolgeId);
                             //seöili olan soför
                             $aracbolgesofor = implode(',', $aracsoforId);
                             //adamın seçili olab bölgedeki diğer şoförleri
                             $adminAracBolgeSofor = $Panel_Model->adminSelectBolgeSofor($aracbolgedizim, $aracbolgesofor);
                             if (count($adminAracBolgeSofor) > 0) {
                                 $d = 0;
                                 foreach ($adminAracBolgeSofor as $adminAracBolgeSoforr) {
                                     $digerAracSofor[$d]['DigerAracSoforID'] = $adminAracBolgeSoforr['BSSoforID'];
                                     $digerAracSofor[$d]['DigerAracSoforAdi'] = $adminAracBolgeSoforr['BSSoforAd'];
                                     $d++;
                                 }
                             }
                         } else {
                             if ($aracHostesCount > 0) {
                                 //arac Hostes idler
                                 $h = 0;
                                 foreach ($adminAracHostes as $adminAracHostess) {
                                     $selectAracHostes[$h]['SelectAracHostesID'] = $adminAracHostess['BSHostesID'];
                                     $selectAracHostes[$h]['SelectAracHostesAdi'] = $adminAracHostess['BSHostesAd'];
                                     $arachostesId[] = $adminAracHostess['BSHostesID'];
                                     $h++;
                                 }
                                 //seçili olan bölge
                                 $aracbolgedizim = implode(',', $aracbolgeId);
                                 //seöili olan hostes
                                 $aracbolgehostes = implode(',', $arachostesId);
                                 //adamın seçili olab bölgedeki diğer hostesleri
                                 $adminAracBolgeHostes = $Panel_Model->adminSelectBolgeHostes($aracbolgedizim, $aracbolgehostes);
                                 if (count($adminAracBolgeHostes) > 0) {
                                     $t = 0;
                                     foreach ($adminAracBolgeHostes as $adminAracBolgeHostess) {
                                         $digerAracHostes[$t]['DigerAracHostesID'] = $adminAracBolgeHostess['BSHostesID'];
                                         $digerAracHostes[$t]['DigerAracHostesAdi'] = $adminAracBolgeHostess['BSHostesAd'];
                                         $t++;
                                     }
                                 }
                             } else {
                                 //seçili olan bölge
                                 $aracbolgedizim = implode(',', $aracbolgeId);
                                 //adamın seçili olab bölgedeki diğer hostesi
                                 $adminAracBolgeHostes = $Panel_Model->adminSelectBolgeHostess($aracbolgedizim);
                                 $t = 0;
                                 foreach ($adminAracBolgeHostes as $adminAracBolgeHostess) {
                                     $digerAracHostes[$t]['DigerAracHostesID'] = $adminAracBolgeHostess['BSHostesID'];
                                     $digerAracHostes[$t]['DigerAracHostesAdi'] = $adminAracBolgeHostess['BSHostesAd'];
                                     $t++;
                                 }
                             }
                             //seçili olan bölge
                             $aracbolgedizim = implode(',', $aracbolgeId);
                             //adamın seçili olab bölgedeki diğer şoförleri
                             $adminAracBolgeSofor = $Panel_Model->adminSelectBolgeSoforr($aracbolgedizim);
                             $d = 0;
                             foreach ($adminAracBolgeSofor as $adminAracBolgeSoforr) {
                                 $digerAracSofor[$d]['DigerAracSoforID'] = $adminAracBolgeSoforr['BSSoforID'];
                                 $digerAracSofor[$d]['DigerAracSoforAdi'] = $adminAracBolgeSoforr['BSSoforAd'];
                                 $d++;
                             }
                         }
                         //araç Özellikleri
                         $aracOzellik = $Panel_Model->adminDetailAracOzellik($adminAracDetailID);
                         $e = 0;
                         foreach ($aracOzellik as $aracOzellikk) {
                             $adminAracDetail[$e]['AdminAracID'] = $aracOzellikk['SBAracID'];
                             $adminAracDetail[$e]['AdminAracPlaka'] = $aracOzellikk['SBAracPlaka'];
                             $adminAracDetail[$e]['AdminAracMarka'] = $aracOzellikk['SBAracMarka'];
                             $adminAracDetail[$e]['AdminAracYil'] = $aracOzellikk['SBAracModelYili'];
                             $adminAracDetail[$e]['AdminAracKapasite'] = $aracOzellikk['SBAracKapasite'];
                             $adminAracDetail[$e]['AdminAracKm'] = $aracOzellikk['SBAracKm'];
                             $adminAracDetail[$e]['AdminAracDurum'] = $aracOzellikk['SBAracDurum'];
                             $adminAracDetail[$e]['AdminAracAciklama'] = $aracOzellikk['SBAracAciklama'];
                             $e++;
                         }
                     } else {
                         $adminID = Session::get("userId");
                         //normal adminse
                         $form->post('adminaracRowid', true);
                         $adminAracDetailID = $form->values['adminaracRowid'];
                         //küçük adminin olan bölgeleri
                         $bolgeListeRutbe = $Panel_Model->AdminbolgeListele($adminID);
                         //bölge idler
                         $bolgerutbeId = [];
                         foreach ($bolgeListeRutbe as $bolgeListeRutbee) {
                             $bolgerutbeId[] = $bolgeListeRutbee['BSBolgeID'];
                         }
                         $rutbebolgedizi = implode(',', $bolgerutbeId);
                         //aracın turu var mı yokmu
                         $adminAracTur = $Panel_Model->adminDetailRutbeAracTur($rutbebolgedizi, $adminAracDetailID);
                         //arac bölge idler
                         $z = 0;
                         foreach ($adminAracTur as $adminAracTurr) {
                             $selectAracTur[$z]['SelectAracTur'] = $adminAracTurr['SBTurAktiflik'];
                             $z++;
                         }
                         $adminAracBolge = $Panel_Model->adminDetailAracBolge($adminAracDetailID);
                         //arac bölge idler
                         $aracbolgeId = [];
                         $a = 0;
                         foreach ($adminAracBolge as $adminAracBolgee) {
                             $selectAracBolge[$a]['SelectAracBolgeID'] = $adminAracBolgee['SBBolgeID'];
                             $selectAracBolge[$a]['SelectAracBolgeAdi'] = $adminAracBolgee['SBBolgeAdi'];
                             $aracbolgeId[] = $adminAracBolgee['SBBolgeID'];
                             $a++;
                         }
                         //küçük admine göre farkını alıp, select olmayan bölgeleri çıkarıyoruz$aracbolgeId
                         $bolgefark = array_diff($bolgerutbeId, $aracbolgeId);
                         $bolgefarkk = implode(',', $bolgefark);
                         //aracın bolgesi dışındakiler
                         $digerBolge = $Panel_Model->adminRutbeDetailAracSBolge($bolgefarkk);
                         //arac diğer bölgeler
                         $b = 0;
                         foreach ($digerBolge as $digerBolgee) {
                             $digerAracBolge[$b]['DigerAracBolgeID'] = $digerBolgee['SBBolgeID'];
                             $digerAracBolge[$b]['DigerAracBolgeAdi'] = $digerBolgee['SBBolgeAdi'];
                             $b++;
                         }
                         //araç şoförler
                         $adminAracSofor = $Panel_Model->adminDetailAracSofor($adminAracDetailID);
                         //araç hostesler
                         $adminAracHostes = $Panel_Model->adminDetailAracHostes($adminAracDetailID);
                         $aracSoforCount = count($adminAracSofor);
                         $aracHostesCount = count($adminAracHostes);
                         if ($aracSoforCount > 0) {
                             if ($aracHostesCount > 0) {
                                 //arac Hostes idler
                                 $h = 0;
                                 foreach ($adminAracHostes as $adminAracHostess) {
                                     $selectAracHostes[$h]['SelectAracHostesID'] = $adminAracHostess['BSHostesID'];
                                     $selectAracHostes[$h]['SelectAracHostesAdi'] = $adminAracHostess['BSHostesAd'];
                                     $arachostesId[] = $adminAracHostess['BSHostesID'];
                                     $h++;
                                 }
                                 //seçili olan bölge
                                 $aracbolgedizim = implode(',', $aracbolgeId);
                                 //seöili olan hostes
                                 $aracbolgehostes = implode(',', $arachostesId);
                                 //adamın seçili olab bölgedeki diğer hostesleri
                                 $adminAracBolgeHostes = $Panel_Model->adminSelectBolgeHostes($aracbolgedizim, $aracbolgehostes);
                                 if (count($adminAracBolgeHostes) > 0) {
                                     $t = 0;
                                     foreach ($adminAracBolgeHostes as $adminAracBolgeHostess) {
                                         $digerAracHostes[$t]['DigerAracHostesID'] = $adminAracBolgeHostess['BSHostesID'];
                                         $digerAracHostes[$t]['DigerAracHostesAdi'] = $adminAracBolgeHostess['BSHostesAd'];
                                         $t++;
                                     }
                                 }
                             } else {
                                 //seçili olan bölge
                                 $aracbolgedizim = implode(',', $aracbolgeId);
                                 //adamın seçili olab bölgedeki diğer hostesi
                                 $adminAracBolgeHostes = $Panel_Model->adminSelectBolgeHostess($aracbolgedizim);
                                 $t = 0;
                                 foreach ($adminAracBolgeHostes as $adminAracBolgeHostess) {
                                     $digerAracHostes[$t]['DigerAracHostesID'] = $adminAracBolgeHostess['BSHostesID'];
                                     $digerAracHostes[$t]['DigerAracHostesAdi'] = $adminAracBolgeHostess['BSHostesAd'];
                                     $t++;
                                 }
                             }
                             //arac Şofor idler
                             $c = 0;
                             foreach ($adminAracSofor as $adminAracSoforr) {
                                 $selectAracSofor[$c]['SelectAracSoforID'] = $adminAracSoforr['BSSoforID'];
                                 $selectAracSofor[$c]['SelectAracSoforAdi'] = $adminAracSoforr['BSSoforAd'];
                                 $aracsoforId[] = $adminAracSoforr['BSSoforID'];
                                 $c++;
                             }
                             //seçili olan bölge
                             $aracbolgedizim = implode(',', $aracbolgeId);
                             $aracbolgesofor = implode(',', $aracsoforId);
                             //adamın seçili olab bölgedeki diğer şoförleri
                             $adminAracBolgeSofor = $Panel_Model->adminSelectBolgeSofor($aracbolgedizim, $aracbolgesofor);
                             $d = 0;
                             foreach ($adminAracBolgeSofor as $adminAracBolgeSoforr) {
                                 $digerAracSofor[$d]['DigerAracSoforID'] = $adminAracBolgeSoforr['BSSoforID'];
                                 $digerAracSofor[$d]['DigerAracSoforAdi'] = $adminAracBolgeSoforr['BSSoforAd'];
                                 $d++;
                             }
                         } else {
                             if ($aracHostesCount > 0) {
                                 //arac Hostes idler
                                 $h = 0;
                                 foreach ($adminAracHostes as $adminAracHostess) {
                                     $selectAracHostes[$h]['SelectAracHostesID'] = $adminAracHostess['BSHostesID'];
                                     $selectAracHostes[$h]['SelectAracHostesAdi'] = $adminAracHostess['BSHostesAd'];
                                     $arachostesId[] = $adminAracHostess['BSHostesID'];
                                     $h++;
                                 }
                                 //seçili olan bölge
                                 $aracbolgedizim = implode(',', $aracbolgeId);
                                 //seçili olan hostes
                                 $aracbolgehostes = implode(',', $arachostesId);
                                 //adamın seçili olab bölgedeki diğer hostesleri
                                 $adminAracBolgeHostes = $Panel_Model->adminSelectBolgeHostes($aracbolgedizim, $aracbolgehostes);
                                 if (count($adminAracBolgeHostes) > 0) {
                                     $t = 0;
                                     foreach ($adminAracBolgeHostes as $adminAracBolgeHostess) {
                                         $digerAracHostes[$t]['DigerAracHostesID'] = $adminAracBolgeHostess['BSHostesID'];
                                         $digerAracHostes[$t]['DigerAracHostesAdi'] = $adminAracBolgeHostess['BSHostesAd'];
                                         $t++;
                                     }
                                 }
                             } else {
                                 //seçili olan bölge
                                 $aracbolgedizim = implode(',', $aracbolgeId);
                                 //adamın seçili olab bölgedeki diğer hostesi
                                 $adminAracBolgeHostes = $Panel_Model->adminSelectBolgeHostess($aracbolgedizim);
                                 $t = 0;
                                 foreach ($adminAracBolgeHostes as $adminAracBolgeHostess) {
                                     $digerAracHostes[$t]['DigerAracHostesID'] = $adminAracBolgeHostess['BSHostesID'];
                                     $digerAracHostes[$t]['DigerAracHostesAdi'] = $adminAracBolgeHostess['BSHostesAd'];
                                     $t++;
                                 }
                             }
                             //adamın seçili olab bölgedeki diğer şoförleri
                             $adminAracBolgeSofor = $Panel_Model->adminSelectBolgeSoforr($rutbebolgedizi);
                             $d = 0;
                             foreach ($adminAracBolgeSofor as $adminAracBolgeSoforr) {
                                 $digerAracSofor[$d]['DigerAracSoforID'] = $adminAracBolgeSoforr['BSSoforID'];
                                 $digerAracSofor[$d]['DigerAracSoforAdi'] = $adminAracBolgeSoforr['BSSoforAd'];
                                 $d++;
                             }
                         }
                         //araç Özellikleri
                         $aracOzellik = $Panel_Model->adminDetailAracOzellik($adminAracDetailID);
                         $e = 0;
                         foreach ($aracOzellik as $aracOzellikk) {
                             $adminAracDetail[$e]['AdminAracID'] = $aracOzellikk['SBAracID'];
                             $adminAracDetail[$e]['AdminAracPlaka'] = $aracOzellikk['SBAracPlaka'];
                             $adminAracDetail[$e]['AdminAracMarka'] = $aracOzellikk['SBAracMarka'];
                             $adminAracDetail[$e]['AdminAracYil'] = $aracOzellikk['SBAracModelYili'];
                             $adminAracDetail[$e]['AdminAracKapasite'] = $aracOzellikk['SBAracKapasite'];
                             $adminAracDetail[$e]['AdminAracKm'] = $aracOzellikk['SBAracKm'];
                             $adminAracDetail[$e]['AdminAracDurum'] = $aracOzellikk['SBAracDurum'];
                             $adminAracDetail[$e]['AdminAracAciklama'] = $aracOzellikk['SBAracAciklama'];
                             $e++;
                         }
                     }
                     //sonuçlar
                     $sonuc["adminAracSelectBolge"] = $selectAracBolge;
                     $sonuc["adminAracBolge"] = $digerAracBolge;
                     $sonuc["adminAracSelectSofor"] = $selectAracSofor;
                     $sonuc["adminAracSofor"] = $digerAracSofor;
                     $sonuc["adminAracSelectHostes"] = $selectAracHostes;
                     $sonuc["adminAracHostes"] = $digerAracHostes;
                     $sonuc["adminAracOzellik"] = $adminAracDetail;
                     $sonuc["adminAracTur"] = $selectAracTur;
                 }
                 break;
             case "adminAracDetailDelete":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $adminRutbe = Session::get("userRutbe");
                     $form->post('aracdetail_id', true);
                     $form->post('arac_plaka', true);
                     $adminAracDetailID = $form->values['aracdetail_id'];
                     $aracPlak = $form->values['arac_plaka'];
                     $aracPlaka = strtoupper($aracPlak);
                     $aracBolgeID = $_REQUEST['aracBolgeID'];
                     $aracSoforID = $_REQUEST['aracSoforID'];
                     $aracHostesID = $_REQUEST['aracHostesID'];
                     $deleteresult = $Panel_Model->adminDetailAracDelete($adminAracDetailID);
                     if ($deleteresult) {
                         $deleteresultt = $Panel_Model->adminDetailAracSoforDelete($adminAracDetailID);
                         if ($deleteresultt) {
                             $deletehostes = $Panel_Model->adminDetailAracHostesDelete($adminAracDetailID);
                             if ($deletehostes) {
                                 $deleteresulttt = $Panel_Model->adminDetailAracBolgeDelete($adminAracDetailID);
                                 if ($deleteresulttt) {
                                     if ($aracSoforID) {
                                         //şoföre bildirim gönderme
                                         $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracSilme"];
                                         $resultSoforCihaz = $Panel_Model->soforCihaz($aracSoforID);
                                         if (count($resultSoforCihaz) > 0) {
                                             foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                 $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                             }
                                             $soforCihazlar = implode(',', $soforCihaz);
                                             $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracSil"]);
                                         }
                                     }
                                     //hostes varsa
                                     if ($aracHostesID) {
                                         //hostese bildirim gönderme
                                         $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracSilme"];
                                         $resultHostesCihaz = $Panel_Model->hostesCihaz($aracHostesID);
                                         if (count($resultHostesCihaz) > 0) {
                                             foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                 $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                             }
                                             $hostesCihazlar = implode(',', $hostesCihaz);
                                             $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracSil"]);
                                         }
                                     }
                                     $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracSilme"];
                                     $aracRenk = 'danger';
                                     $aracUrl = 'aracliste';
                                     $aracIcon = 'fa fa-bus';
                                     //bildirim ayarları
                                     if ($adminRutbe != 1) {
                                         //normal admin
                                         $adminBolgeler = implode(',', $aracBolgeID);
                                         $adminIDLer = array(1, $adminID);
                                         $adminImplodeID = implode(',', $adminIDLer);
                                         $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($adminBolgeler, $adminImplodeID);
                                         $adminBolgeCount = count($resultAdminBolgeler);
                                         if ($adminBolgeCount > 0) {
                                             //diğer adminler
                                             $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                             for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                 $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 31);
                                             }
                                             $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                             if ($resultBildirim) {
                                                 $adminNotfIDLer = array(1, $adminImplodeID);
                                                 $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                 $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                 if (count($resultAdminCihaz) > 0) {
                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                     }
                                                     $adminCihaz = implode(',', $adminCihaz);
                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                 }
                                             }
                                         } else {
                                             $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                             $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                             if ($resultBildirim) {
                                                 $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                 if (count($resultAdminCihaz) > 0) {
                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                     }
                                                     $adminCihaz = implode(',', $adminCihaz);
                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                 }
                                             }
                                         }
                                     } else {
                                         //üst admin
                                         $adminBolgeler = implode(',', $aracBolgeID);
                                         $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($adminBolgeler);
                                         $adminIDCount = count($resultBolgeAdminID);
                                         if ($adminIDCount > 0) {
                                             for ($b = 0; $b < $adminIDCount; $b++) {
                                                 $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 31);
                                             }
                                             $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                             if ($resultBildirim) {
                                                 $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                 $adminNotfIDLer = array($adminImplodeID);
                                                 $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                 $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                 if (count($resultAdminCihaz) > 0) {
                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                     }
                                                     $adminCihaz = implode(',', $adminCihaz);
                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                 }
                                             }
                                         }
                                     }
                                     //log ayarları
                                     $dataLog = $form->adminBildirimLogDuzen($adminID, $adSoyad, $alert);
                                     $resultLog = $Panel_Model->addNewAdminBildirimLog($dataLog);
                                     if ($resultLog) {
                                         $sonuc["delete"] = $deger["AracSil"];
                                     } else {
                                         $sonuc["hata"] = $deger["Hata"];
                                     }
                                 }
                             } else {
                                 $deleteresulttt = $Panel_Model->adminDetailAracBolgeDelete($adminAracDetailID);
                                 if ($deleteresulttt) {
                                     $sonuc["delete"] = $deger["AracSil"];
                                 }
                             }
                         } else {
                             $deletehostes = $Panel_Model->adminDetailAracHostesDelete($adminAracDetailID);
                             if ($deletehostes) {
                                 $deleteresulttt = $Panel_Model->adminDetailAracBolgeDelete($adminAracDetailID);
                                 if ($deleteresulttt) {
                                     $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracSilme"];
                                     $aracRenk = 'danger';
                                     $aracUrl = 'aracliste';
                                     $aracIcon = 'fa fa-bus';
                                     //bildirim ayarları
                                     if ($adminRutbe != 1) {
                                         //normal admin
                                         $adminBolgeler = implode(',', $aracBolgeID);
                                         $adminIDLer = array(1, $adminID);
                                         $adminImplodeID = implode(',', $adminIDLer);
                                         $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($adminBolgeler, $adminImplodeID);
                                         $adminBolgeCount = count($resultAdminBolgeler);
                                         if ($adminBolgeCount > 0) {
                                             //diğer adminler
                                             $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                             for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                 $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 31);
                                             }
                                             $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                             if ($resultBildirim) {
                                                 $adminNotfIDLer = array(1, $adminImplodeID);
                                                 $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                 $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                 if (count($resultAdminCihaz) > 0) {
                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                     }
                                                     $adminCihaz = implode(',', $adminCihaz);
                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                 }
                                             }
                                         } else {
                                             $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                             $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                             if ($resultBildirim) {
                                                 $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                 if (count($resultAdminCihaz) > 0) {
                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                     }
                                                     $adminCihaz = implode(',', $adminCihaz);
                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                 }
                                             }
                                         }
                                     } else {
                                         //üst admin
                                         $adminBolgeler = implode(',', $aracBolgeID);
                                         $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($adminBolgeler);
                                         $adminIDCount = count($resultBolgeAdminID);
                                         if ($adminIDCount > 0) {
                                             for ($b = 0; $b < $adminIDCount; $b++) {
                                                 $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 31);
                                             }
                                             $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                             if ($resultBildirim) {
                                                 $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                 $adminNotfIDLer = array($adminImplodeID);
                                                 $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                 $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                 if (count($resultAdminCihaz) > 0) {
                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                     }
                                                     $adminCihaz = implode(',', $adminCihaz);
                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                 }
                                             }
                                         }
                                     }
                                     //log ayarları
                                     $dataLog = $form->adminBildirimLogDuzen($adminID, $adSoyad, $alert);
                                     $resultLog = $Panel_Model->addNewAdminBildirimLog($dataLog);
                                     if ($resultLog) {
                                         $sonuc["delete"] = $deger["AracSil"];
                                     } else {
                                         $sonuc["hata"] = $deger["Hata"];
                                     }
                                 }
                             } else {
                                 $deleteresulttt = $Panel_Model->adminDetailAracBolgeDelete($adminAracDetailID);
                                 if ($deleteresulttt) {
                                     $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracSilme"];
                                     $aracRenk = 'danger';
                                     $aracUrl = 'aracliste';
                                     $aracIcon = 'fa fa-bus';
                                     //bildirim ayarları
                                     if ($adminRutbe != 1) {
                                         //normal admin
                                         $adminBolgeler = implode(',', $aracBolgeID);
                                         $adminIDLer = array(1, $adminID);
                                         $adminImplodeID = implode(',', $adminIDLer);
                                         $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($adminBolgeler, $adminImplodeID);
                                         $adminBolgeCount = count($resultAdminBolgeler);
                                         if ($adminBolgeCount > 0) {
                                             //diğer adminler
                                             $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                             for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                 $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 31);
                                             }
                                             $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                             if ($resultBildirim) {
                                                 $adminNotfIDLer = array(1, $adminImplodeID);
                                                 $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                 $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                 if (count($resultAdminCihaz) > 0) {
                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                     }
                                                     $adminCihaz = implode(',', $adminCihaz);
                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                 }
                                             }
                                         } else {
                                             $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                             $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                             if ($resultBildirim) {
                                                 $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                 if (count($resultAdminCihaz) > 0) {
                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                     }
                                                     $adminCihaz = implode(',', $adminCihaz);
                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                 }
                                             }
                                         }
                                     } else {
                                         //üst admin
                                         $adminBolgeler = implode(',', $aracBolgeID);
                                         $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($adminBolgeler);
                                         $adminIDCount = count($resultBolgeAdminID);
                                         if ($adminIDCount > 0) {
                                             for ($b = 0; $b < $adminIDCount; $b++) {
                                                 $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 31);
                                             }
                                             $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                             if ($resultBildirim) {
                                                 $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                 $adminNotfIDLer = array($adminImplodeID);
                                                 $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                 $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                 if (count($resultAdminCihaz) > 0) {
                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                     }
                                                     $adminCihaz = implode(',', $adminCihaz);
                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                 }
                                             }
                                         }
                                     }
                                     //log ayarları
                                     $dataLog = $form->adminBildirimLogDuzen($adminID, $adSoyad, $alert);
                                     $resultLog = $Panel_Model->addNewAdminBildirimLog($dataLog);
                                     if ($resultLog) {
                                         $sonuc["delete"] = $deger["AracSil"];
                                     } else {
                                         $sonuc["hata"] = $deger["Hata"];
                                     }
                                 }
                             }
                         }
                     } else {
                         $sonuc["hata"] = $deger["Hata"];
                     }
                 }
                 $sonuc["adminKurumDetail"] = $data["adminKurumDetail"];
                 break;
             case "adminAracDetailKaydet":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $adminRutbe = Session::get("userRutbe");
                     $form->post('aracdetail_id', true);
                     $aracID = $form->values['aracdetail_id'];
                     $form->post('aracPlaka', true);
                     $form->post('aracMarka', true);
                     $form->post('aracModelYil', true);
                     $form->post('aracKapasite', true);
                     $form->post('aracAciklama', true);
                     $form->post('aracDurum', true);
                     $aracPlak = $form->values['aracPlaka'];
                     $aracPlaka = strtoupper($aracPlak);
                     $aracSoforID = $_REQUEST['aracSoforID'];
                     $aracSoforAd = $_REQUEST['aracSoforAd'];
                     $aracHostesID = $_REQUEST['aracHostesID'];
                     $aracHostesAd = $_REQUEST['aracHostesAd'];
                     $aracBolgeAd = $_REQUEST['aracBolgeAd'];
                     $aracBolgeID = $_REQUEST['aracBolgeID'];
                     $aracEskiBolgeID = $_REQUEST['aracEskiBolgeID'];
                     $aracEskiSoforID = $_REQUEST['aracEskiSoforID'];
                     $aracEskiHostesID = $_REQUEST['aracEskiHostesID'];
                     if ($form->submit()) {
                         $data = array('SBAracMarka' => $form->values['aracMarka'], 'SBAracModelYili' => $form->values['aracModelYil'], 'SBAracPlaka' => $aracPlaka, 'SBAracKapasite' => $form->values['aracKapasite'], 'SBAracAciklama' => $form->values['aracAciklama'], 'SBAracDurum' => $form->values['aracDurum']);
                     }
                     $resultAracUpdate = $Panel_Model->adminAracOzelliklerDuzenle($data, $aracID);
                     if ($resultAracUpdate) {
                         $soforID = count($aracSoforID);
                         $hostesID = count($aracHostesID);
                         if ($soforID > 0) {
                             $deleteresultt = $Panel_Model->adminAracSoforDelete($aracID);
                             for ($a = 0; $a < $soforID; $a++) {
                                 $sofordata[$a] = array('BSAracID' => $aracID, 'BSAracPlaka' => $aracPlaka, 'BSSoforID' => $aracSoforID[$a], 'BSSoforAd' => $aracSoforAd[$a]);
                             }
                             $resultSoforUpdate = $Panel_Model->addNewAdminAracSofor($sofordata);
                             if ($resultSoforUpdate) {
                                 //hostes seçildi ise
                                 if ($hostesID > 0) {
                                     $deletehostes = $Panel_Model->adminAracHostesDelete($aracID);
                                     for ($h = 0; $h < $hostesID; $h++) {
                                         $hostesdata[$h] = array('BSAracID' => $aracID, 'BSAracPlaka' => $aracPlaka, 'BSHostesID' => $aracHostesID[$h], 'BSHostesAd' => $aracHostesAd[$h]);
                                     }
                                     $resultHostesUpdate = $Panel_Model->addNewAdminAracHostes($hostesdata);
                                 }
                                 $bolgeID = count($aracBolgeID);
                                 $deleteresulttt = $Panel_Model->adminDetailAracBolgeDelete($aracID);
                                 if ($deleteresulttt) {
                                     for ($b = 0; $b < $bolgeID; $b++) {
                                         $bolgedata[$b] = array('SBAracID' => $aracID, 'SBAracPlaka' => $aracPlaka, 'SBBolgeID' => $aracBolgeID[$b], 'SBBolgeAdi' => $aracBolgeAd[$b]);
                                     }
                                     $resultBolgeID = $Panel_Model->addNewAdminBolgeSofor($bolgedata);
                                     if ($resultBolgeID) {
                                         //yeni bölge ile eski bölge arasıdnaki farklar
                                         if (count($aracBolgeID) >= count($aracEskiBolgeID)) {
                                             $bolgeIDEklenen = array_diff($aracBolgeID, $aracEskiBolgeID);
                                             if (count($bolgeIDEklenen) > 0) {
                                                 //fark var
                                                 //yeni bölge eklenmiş
                                                 $yeniEklenen = implode(",", $bolgeIDEklenen);
                                                 //yeni eklenen bölge ayarı
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracEkleme"];
                                                 $aracRenk = 'success';
                                                 $aracUrl = 'aracliste';
                                                 $aracIcon = 'fa fa-bus';
                                                 //bildirim ayarları
                                                 if ($adminRutbe != 1) {
                                                     //normal admin
                                                     $adminIDLer = array(1, $adminID);
                                                     $adminImplodeID = implode(',', $adminIDLer);
                                                     $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($yeniEklenen, $adminImplodeID);
                                                     $adminBolgeCount = count($resultAdminBolgeler);
                                                     if ($adminBolgeCount > 0) {
                                                         //diğer adminler
                                                         $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 11);
                                                         for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                             $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 11);
                                                         }
                                                         $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                         if ($resultBildirim) {
                                                             $adminNotfIDLer = array(1, $adminImplodeID);
                                                             $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                             $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                             }
                                                         }
                                                     } else {
                                                         $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 11);
                                                         $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                         if ($resultBildirim) {
                                                             $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                             }
                                                         }
                                                     }
                                                 } else {
                                                     //üst admin
                                                     $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($yeniEklenen);
                                                     $adminIDCount = count($resultBolgeAdminID);
                                                     if ($adminIDCount > 0) {
                                                         for ($b = 0; $b < $adminIDCount; $b++) {
                                                             $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 11);
                                                         }
                                                         $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                         if ($resultBildirim) {
                                                             $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                             $adminNotfIDLer = array($adminImplodeID);
                                                             $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                             $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                             }
                                                         }
                                                     }
                                                 }
                                                 $bolgeIDSilinen = array_diff($aracEskiBolgeID, $aracBolgeID);
                                                 if (count($bolgeIDSilinen) > 0) {
                                                     $yeniSilinen = implode(",", $bolgeIDSilinen);
                                                     //bölgeden araç silindi
                                                     $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracSilme"];
                                                     $aracRenk = 'danger';
                                                     $aracUrl = 'aracliste';
                                                     $aracIcon = 'fa fa-bus';
                                                     //bildirim ayarları
                                                     if ($adminRutbe != 1) {
                                                         //normal admin
                                                         $adminIDLer = array(1, $adminID);
                                                         $adminImplodeID = implode(',', $adminIDLer);
                                                         $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($yeniSilinen, $adminImplodeID);
                                                         $adminBolgeCount = count($resultAdminBolgeler);
                                                         if ($adminBolgeCount > 0) {
                                                             //diğer adminler
                                                             $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                                             for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                                 $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 31);
                                                             }
                                                             $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                             if ($resultBildirim) {
                                                                 $adminNotfIDLer = array(1, $adminImplodeID);
                                                                 $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                                 $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                                 if (count($resultAdminCihaz) > 0) {
                                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                     }
                                                                     $adminCihaz = implode(',', $adminCihaz);
                                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                                 }
                                                             }
                                                         } else {
                                                             $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                                             $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                             if ($resultBildirim) {
                                                                 $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                                 if (count($resultAdminCihaz) > 0) {
                                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                     }
                                                                     $adminCihaz = implode(',', $adminCihaz);
                                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                                 }
                                                             }
                                                         }
                                                     } else {
                                                         //üst admin
                                                         $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($yeniSilinen);
                                                         $adminIDCount = count($resultBolgeAdminID);
                                                         if ($adminIDCount > 0) {
                                                             for ($b = 0; $b < $adminIDCount; $b++) {
                                                                 $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 31);
                                                             }
                                                             $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                             if ($resultBildirim) {
                                                                 $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                                 $adminNotfIDLer = array($adminImplodeID);
                                                                 $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                                 $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                                 if (count($resultAdminCihaz) > 0) {
                                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                     }
                                                                     $adminCihaz = implode(',', $adminCihaz);
                                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             } else {
                                                 //fark yok sa demekki dizide değişiklik yok yani dizi ile ilgili düzenleme yapılmakta
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                                 $aracRenk = 'warning';
                                                 $aracUrl = 'aracliste';
                                                 $aracIcon = 'fa fa-bus';
                                                 //bildirim ayarları
                                                 if ($adminRutbe != 1) {
                                                     //normal admin
                                                     $adminBolgeler = implode(',', $aracBolgeID);
                                                     $adminIDLer = array(1, $adminID);
                                                     $adminImplodeID = implode(',', $adminIDLer);
                                                     $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($adminBolgeler, $adminImplodeID);
                                                     $adminBolgeCount = count($resultAdminBolgeler);
                                                     if ($adminBolgeCount > 0) {
                                                         //diğer adminler
                                                         $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 51);
                                                         for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                             $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 51);
                                                         }
                                                         $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                         if ($resultBildirim) {
                                                             $adminNotfIDLer = array(1, $adminImplodeID);
                                                             $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                             $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                             }
                                                         }
                                                     } else {
                                                         $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 51);
                                                         $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                         if ($resultBildirim) {
                                                             $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                             }
                                                         }
                                                     }
                                                 } else {
                                                     //üst admin
                                                     $adminBolgeler = implode(',', $aracBolgeID);
                                                     $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($adminBolgeler);
                                                     $adminIDCount = count($resultBolgeAdminID);
                                                     if ($adminIDCount > 0) {
                                                         for ($b = 0; $b < $adminIDCount; $b++) {
                                                             $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 51);
                                                         }
                                                         $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                         if ($resultBildirim) {
                                                             $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                             $adminNotfIDLer = array($adminImplodeID);
                                                             $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                             $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         } else {
                                             $bolgeIDEklenen = array_diff($aracBolgeID, $aracEskiBolgeID);
                                             if (count($bolgeIDEklenen) > 0) {
                                                 //fark var
                                                 $yeniEklenen = implode(",", $bolgeIDEklenen);
                                                 //yeni eklenen bölge ayarı
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracEkleme"];
                                                 $aracRenk = 'success';
                                                 $aracUrl = 'aracliste';
                                                 $aracIcon = 'fa fa-bus';
                                                 //bildirim ayarları
                                                 if ($adminRutbe != 1) {
                                                     //normal admin
                                                     $adminIDLer = array(1, $adminID);
                                                     $adminImplodeID = implode(',', $adminIDLer);
                                                     $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($yeniEklenen, $adminImplodeID);
                                                     $adminBolgeCount = count($resultAdminBolgeler);
                                                     if ($adminBolgeCount > 0) {
                                                         //diğer adminler
                                                         $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 11);
                                                         for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                             $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 11);
                                                         }
                                                         $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                         if ($resultBildirim) {
                                                             $adminNotfIDLer = array(1, $adminImplodeID);
                                                             $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                             $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                             }
                                                         }
                                                     } else {
                                                         $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 11);
                                                         $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                         if ($resultBildirim) {
                                                             $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                             }
                                                         }
                                                     }
                                                 } else {
                                                     //üst admin
                                                     $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($yeniEklenen);
                                                     $adminIDCount = count($resultBolgeAdminID);
                                                     if ($adminIDCount > 0) {
                                                         for ($b = 0; $b < $adminIDCount; $b++) {
                                                             $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 11);
                                                         }
                                                         $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                         if ($resultBildirim) {
                                                             $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                             $adminNotfIDLer = array($adminImplodeID);
                                                             $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                             $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                             }
                                                         }
                                                     }
                                                 }
                                                 $bolgeIDSilinen = array_diff($aracEskiBolgeID, $aracBolgeID);
                                                 if (count($bolgeIDSilinen) > 0) {
                                                     $yeniSilinen = implode(",", $bolgeIDSilinen);
                                                     //bölgeden araç silindi
                                                     $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracSilme"];
                                                     $aracRenk = 'danger';
                                                     $aracUrl = 'aracliste';
                                                     $aracIcon = 'fa fa-bus';
                                                     //bildirim ayarları
                                                     if ($adminRutbe != 1) {
                                                         //normal admin
                                                         $adminIDLer = array(1, $adminID);
                                                         $adminImplodeID = implode(',', $adminIDLer);
                                                         $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($yeniSilinen, $adminImplodeID);
                                                         $adminBolgeCount = count($resultAdminBolgeler);
                                                         if ($adminBolgeCount > 0) {
                                                             //diğer adminler
                                                             $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                                             for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                                 $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 31);
                                                             }
                                                             $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                             if ($resultBildirim) {
                                                                 $adminNotfIDLer = array(1, $adminImplodeID);
                                                                 $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                                 $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                                 if (count($resultAdminCihaz) > 0) {
                                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                     }
                                                                     $adminCihaz = implode(',', $adminCihaz);
                                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                                 }
                                                             }
                                                         } else {
                                                             $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                                             $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                             if ($resultBildirim) {
                                                                 $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                                 if (count($resultAdminCihaz) > 0) {
                                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                     }
                                                                     $adminCihaz = implode(',', $adminCihaz);
                                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                                 }
                                                             }
                                                         }
                                                     } else {
                                                         //üst admin
                                                         $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($yeniSilinen);
                                                         $adminIDCount = count($resultBolgeAdminID);
                                                         if ($adminIDCount > 0) {
                                                             for ($b = 0; $b < $adminIDCount; $b++) {
                                                                 $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 31);
                                                             }
                                                             $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                             if ($resultBildirim) {
                                                                 $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                                 $adminNotfIDLer = array($adminImplodeID);
                                                                 $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                                 $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                                 if (count($resultAdminCihaz) > 0) {
                                                                     foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                         $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                     }
                                                                     $adminCihaz = implode(',', $adminCihaz);
                                                                     $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             } else {
                                                 //fark yok sa demekki dizide değişiklik yok yani dizi ile ilgili düzenleme yapılmakta
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                                 $aracRenk = 'warning';
                                                 $aracUrl = 'aracliste';
                                                 $aracIcon = 'fa fa-bus';
                                                 //bildirim ayarları
                                                 if ($adminRutbe != 1) {
                                                     //normal admin
                                                     $adminBolgeler = implode(',', $aracBolgeID);
                                                     $adminIDLer = array(1, $adminID);
                                                     $adminImplodeID = implode(',', $adminIDLer);
                                                     $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($adminBolgeler, $adminImplodeID);
                                                     $adminBolgeCount = count($resultAdminBolgeler);
                                                     if ($adminBolgeCount > 0) {
                                                         //diğer adminler
                                                         $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 51);
                                                         for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                             $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 51);
                                                         }
                                                         $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                         if ($resultBildirim) {
                                                             $adminNotfIDLer = array(1, $adminImplodeID);
                                                             $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                             $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                             }
                                                         }
                                                     } else {
                                                         $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 51);
                                                         $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                         if ($resultBildirim) {
                                                             $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                             }
                                                         }
                                                     }
                                                 } else {
                                                     //üst admin
                                                     $adminBolgeler = implode(',', $aracBolgeID);
                                                     $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($adminBolgeler);
                                                     $adminIDCount = count($resultBolgeAdminID);
                                                     if ($adminIDCount > 0) {
                                                         for ($b = 0; $b < $adminIDCount; $b++) {
                                                             $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 51);
                                                         }
                                                         $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                         if ($resultBildirim) {
                                                             $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                             $adminNotfIDLer = array($adminImplodeID);
                                                             $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                             $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                         //yeni şoför eski şoför farkları varsa
                                         if (count($aracSoforID) >= count($aracEskiSoforID)) {
                                             $soforIDEklenen = array_diff($aracSoforID, $aracEskiSoforID);
                                             if (count($soforIDEklenen) > 0) {
                                                 //fark var
                                                 //yeni şoför eklenmiş
                                                 $yeniEklenen = implode(",", $soforIDEklenen);
                                                 //şoföre bildirim gönderme
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracAtama"];
                                                 $resultSoforCihaz = $Panel_Model->soforCihaz($yeniEklenen);
                                                 if (count($resultSoforCihaz) > 0) {
                                                     foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                         $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                                     }
                                                     $soforCihazlar = implode(',', $soforCihaz);
                                                     $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracAta"]);
                                                 }
                                                 $soforIDSilinen = array_diff($aracEskiSoforID, $aracSoforID);
                                                 if (count($soforIDSilinen) > 0) {
                                                     $yeniSilinen = implode(",", $soforIDSilinen);
                                                     $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracCıkarma"];
                                                     $resultSoforCihaz = $Panel_Model->soforCihaz($yeniSilinen);
                                                     if (count($resultSoforCihaz) > 0) {
                                                         foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                             $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                                         }
                                                         $soforCihazlar = implode(',', $soforCihaz);
                                                         $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracSil"]);
                                                     }
                                                 }
                                             } else {
                                                 //fark yok sa demekki dizide değişiklik yok yani dizi ile ilgili düzenleme yapılmakta
                                                 $yeniDuzenlenen = implode(",", $aracSoforID);
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                                 $resultSoforCihaz = $Panel_Model->soforCihaz($yeniDuzenlenen);
                                                 if (count($resultSoforCihaz) > 0) {
                                                     foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                         $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                                     }
                                                     $soforCihazlar = implode(',', $soforCihaz);
                                                     $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracDuzen"]);
                                                 }
                                             }
                                         } else {
                                             $soforIDEklenen = array_diff($aracSoforID, $aracEskiSoforID);
                                             if (count($soforIDEklenen) > 0) {
                                                 //fark var
                                                 $yeniEklenen = implode(",", $soforIDEklenen);
                                                 //şoföre bildirim gönderme
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracAtama"];
                                                 $resultSoforCihaz = $Panel_Model->soforCihaz($yeniEklenen);
                                                 if (count($resultSoforCihaz) > 0) {
                                                     foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                         $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                                     }
                                                     $soforCihazlar = implode(',', $soforCihaz);
                                                     $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracAta"]);
                                                 }
                                                 $soforIDSilinen = array_diff($aracEskiSoforID, $aracSoforID);
                                                 if (count($soforIDSilinen) > 0) {
                                                     $yeniSilinen = implode(",", $soforIDSilinen);
                                                     $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracCıkarma"];
                                                     $resultSoforCihaz = $Panel_Model->soforCihaz($yeniSilinen);
                                                     if (count($resultSoforCihaz) > 0) {
                                                         foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                             $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                                         }
                                                         $soforCihazlar = implode(',', $soforCihaz);
                                                         $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracSil"]);
                                                     }
                                                 }
                                             } else {
                                                 //fark yok sa demekki dizide değişiklik yok yani dizi ile ilgili düzenleme yapılmakta
                                                 $yeniDuzenlenen = implode(",", $aracSoforID);
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                                 $resultSoforCihaz = $Panel_Model->soforCihaz($yeniDuzenlenen);
                                                 if (count($resultSoforCihaz) > 0) {
                                                     foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                         $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                                     }
                                                     $soforCihazlar = implode(',', $soforCihaz);
                                                     $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracDuzen"]);
                                                 }
                                             }
                                         }
                                         //yeni hostes eski hostes farkları varsa
                                         if (count($aracHostesID) >= count($aracEskiHostesID)) {
                                             $hostesIDEklenen = array_diff($aracHostesID, $aracEskiHostesID);
                                             if (count($hostesIDEklenen) > 0) {
                                                 //fark var
                                                 //yeni hostes eklenmiş
                                                 $yeniEklenen = implode(",", $hostesIDEklenen);
                                                 //hostese bildirim gönderme
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracAtama"];
                                                 $resultHostesCihaz = $Panel_Model->hostesCihaz($yeniEklenen);
                                                 if (count($resultHostesCihaz) > 0) {
                                                     foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                         $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                                     }
                                                     $hostesCihazlar = implode(',', $hostesCihaz);
                                                     $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracAta"]);
                                                 }
                                                 $hostesIDSilinen = array_diff($aracEskiHostesID, $aracHostesID);
                                                 if (count($hostesIDSilinen) > 0) {
                                                     $yeniSilinen = implode(",", $hostesIDSilinen);
                                                     $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracCıkarma"];
                                                     $resultHostesCihaz = $Panel_Model->hostesCihaz($yeniSilinen);
                                                     if (count($resultHostesCihaz) > 0) {
                                                         foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                             $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                                         }
                                                         $hostesCihazlar = implode(',', $hostesCihaz);
                                                         $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracSil"]);
                                                     }
                                                 }
                                             } else {
                                                 //fark yok sa demekki dizide değişiklik yok yani dizi ile ilgili düzenleme yapılmakta
                                                 $yeniDuzenlenen = implode(",", $aracHostesID);
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                                 $resultHostesCihaz = $Panel_Model->hostesCihaz($yeniDuzenlenen);
                                                 if (count($resultHostesCihaz) > 0) {
                                                     foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                         $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                                     }
                                                     $hostesCihazlar = implode(',', $hostesCihaz);
                                                     $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracDuzen"]);
                                                 }
                                             }
                                         } else {
                                             $hostesIDEklenen = array_diff($aracHostesID, $aracEskiHostesID);
                                             if (count($hostesIDEklenen) > 0) {
                                                 //fark var
                                                 $yeniEklenen = implode(",", $hostesIDEklenen);
                                                 //şoföre bildirim gönderme
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracAtama"];
                                                 $resultHostesCihaz = $Panel_Model->hostesCihaz($yeniEklenen);
                                                 if (count($resultHostesCihaz) > 0) {
                                                     foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                         $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                                     }
                                                     $hostesCihazlar = implode(',', $hostesCihaz);
                                                     $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracAta"]);
                                                 }
                                                 $hostesIDSilinen = array_diff($aracEskiHostesID, $aracHostesID);
                                                 if (count($hostesIDSilinen) > 0) {
                                                     $yeniSilinen = implode(",", $hostesIDSilinen);
                                                     $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracCıkarma"];
                                                     $resultHostesCihaz = $Panel_Model->soforCihaz($yeniSilinen);
                                                     if (count($resultHostesCihaz) > 0) {
                                                         foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                             $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                                         }
                                                         $hostesCihazlar = implode(',', $hostesCihaz);
                                                         $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracSil"]);
                                                     }
                                                 }
                                             } else {
                                                 //fark yok sa demekki dizide değişiklik yok yani dizi ile ilgili düzenleme yapılmakta
                                                 $yeniDuzenlenen = implode(",", $aracHostesID);
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                                 $resultHostesCihaz = $Panel_Model->soforCihaz($yeniDuzenlenen);
                                                 if (count($resultHostesCihaz) > 0) {
                                                     foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                         $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                                     }
                                                     $hostesCihazlar = implode(',', $hostesCihaz);
                                                     $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracDuzen"]);
                                                 }
                                             }
                                         }
                                         //düzenleme yapılırken ortak bölge id leri için
                                         $bolgeIDOrtak = array_intersect($aracBolgeID, $aracEskiBolgeID);
                                         if (count($bolgeIDOrtak) > 0) {
                                             $yeniOrtakBolge = implode(",", $bolgeIDOrtak);
                                             //bölgeden araç düzenleme
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                             $aracRenk = 'warning';
                                             $aracUrl = 'aracliste';
                                             $aracIcon = 'fa fa-bus';
                                             //bildirim ayarları
                                             if ($adminRutbe != 1) {
                                                 //normal admin
                                                 $adminIDLer = array(1, $adminID);
                                                 $adminImplodeID = implode(',', $adminIDLer);
                                                 $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($yeniOrtakBolge, $adminImplodeID);
                                                 $adminBolgeCount = count($resultAdminBolgeler);
                                                 if ($adminBolgeCount > 0) {
                                                     //diğer adminler
                                                     $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                                     for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                         $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 31);
                                                     }
                                                     $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                     if ($resultBildirim) {
                                                         $adminNotfIDLer = array(1, $adminImplodeID);
                                                         $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                         $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                         }
                                                     }
                                                 } else {
                                                     $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                                     $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                     if ($resultBildirim) {
                                                         $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                         }
                                                     }
                                                 }
                                             } else {
                                                 //üst admin
                                                 $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($yeniOrtakBolge);
                                                 $adminIDCount = count($resultBolgeAdminID);
                                                 if ($adminIDCount > 0) {
                                                     for ($b = 0; $b < $adminIDCount; $b++) {
                                                         $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 31);
                                                     }
                                                     $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                     if ($resultBildirim) {
                                                         $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                         $adminNotfIDLer = array($adminImplodeID);
                                                         $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                         $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                         $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                         //log ayarları
                                         $dataLog = $form->adminBildirimLogDuzen($adminID, $adSoyad, $alert);
                                         $resultLog = $Panel_Model->addNewAdminBildirimLog($dataLog);
                                         if ($resultLog) {
                                             $sonuc["newAracID"] = $aracID;
                                             $sonuc["update"] = $deger["AracDuzenle"];
                                         } else {
                                             $sonuc["hata"] = $deger["Hata"];
                                         }
                                     } else {
                                         $sonuc["hata"] = $deger["Hata"];
                                     }
                                 } else {
                                     $sonuc["hata"] = $deger["Hata"];
                                 }
                             } else {
                                 $sonuc["hata"] = $deger["Hata"];
                             }
                         } else {
                             //hostes seçildi ise
                             if ($hostesID > 0) {
                                 $deletehostes = $Panel_Model->adminAracHostesDelete($aracID);
                                 for ($h = 0; $h < $hostesID; $h++) {
                                     $hostesdata[$h] = array('BSAracID' => $aracID, 'BSAracPlaka' => $aracPlaka, 'BSHostesID' => $aracHostesID[$h], 'BSHostesAd' => $aracHostesAd[$h]);
                                 }
                                 $resultHostesUpdate = $Panel_Model->addNewAdminAracHostes($hostesdata);
                             }
                             $deleteresultt = $Panel_Model->adminAracSoforDelete($aracID);
                             $deleteresulttt = $Panel_Model->adminDetailAracBolgeDelete($aracID);
                             if ($deleteresulttt) {
                                 $bolgeID = count($aracBolgeID);
                                 for ($b = 0; $b < $bolgeID; $b++) {
                                     $bolgedata[$b] = array('SBAracID' => $aracID, 'SBAracPlaka' => $aracPlaka, 'SBBolgeID' => $aracBolgeID[$b], 'SBBolgeAdi' => $aracBolgeAd[$b]);
                                 }
                                 $resultBolgeID = $Panel_Model->addNewAdminBolgeSofor($bolgedata);
                                 if ($resultBolgeID) {
                                     $resultMemcache = $MemcacheModel->get($uniqueKey);
                                     if ($resultMemcache) {
                                         $resultDelete = $MemcacheModel->deleteKey($uniqueKey);
                                     }
                                     //yeni bölge ile eski bölge arasıdnaki farklar
                                     if (count($aracBolgeID) >= count($aracEskiBolgeID)) {
                                         $bolgeIDEklenen = array_diff($aracBolgeID, $aracEskiBolgeID);
                                         if (count($bolgeIDEklenen) > 0) {
                                             //fark var
                                             //yeni bölge eklenmiş
                                             $yeniEklenen = implode(",", $bolgeIDEklenen);
                                             //yeni eklenen bölge ayarı
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracEkleme"];
                                             $aracRenk = 'success';
                                             $aracUrl = 'aracliste';
                                             $aracIcon = 'fa fa-bus';
                                             //bildirim ayarları
                                             if ($adminRutbe != 1) {
                                                 //normal admin
                                                 $adminIDLer = array(1, $adminID);
                                                 $adminImplodeID = implode(',', $adminIDLer);
                                                 $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($yeniEklenen, $adminImplodeID);
                                                 $adminBolgeCount = count($resultAdminBolgeler);
                                                 if ($adminBolgeCount > 0) {
                                                     //diğer adminler
                                                     $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 11);
                                                     for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                         $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 11);
                                                     }
                                                     $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                     if ($resultBildirim) {
                                                         $adminNotfIDLer = array(1, $adminImplodeID);
                                                         $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                         $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                         }
                                                     }
                                                 } else {
                                                     $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 11);
                                                     $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                     if ($resultBildirim) {
                                                         $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                         }
                                                     }
                                                 }
                                             } else {
                                                 //üst admin
                                                 $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($yeniEklenen);
                                                 $adminIDCount = count($resultBolgeAdminID);
                                                 if ($adminIDCount > 0) {
                                                     for ($b = 0; $b < $adminIDCount; $b++) {
                                                         $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 11);
                                                     }
                                                     $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                     if ($resultBildirim) {
                                                         $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                         $adminNotfIDLer = array($adminImplodeID);
                                                         $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                         $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                         }
                                                     }
                                                 }
                                             }
                                             $bolgeIDSilinen = array_diff($aracEskiBolgeID, $aracBolgeID);
                                             if (count($bolgeIDSilinen) > 0) {
                                                 $yeniSilinen = implode(",", $bolgeIDSilinen);
                                                 //bölgeden araç silindi
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracSilme"];
                                                 $aracRenk = 'danger';
                                                 $aracUrl = 'aracliste';
                                                 $aracIcon = 'fa fa-bus';
                                                 //bildirim ayarları
                                                 if ($adminRutbe != 1) {
                                                     //normal admin
                                                     $adminIDLer = array(1, $adminID);
                                                     $adminImplodeID = implode(',', $adminIDLer);
                                                     $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($yeniSilinen, $adminImplodeID);
                                                     $adminBolgeCount = count($resultAdminBolgeler);
                                                     if ($adminBolgeCount > 0) {
                                                         //diğer adminler
                                                         $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                                         for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                             $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 31);
                                                         }
                                                         $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                         if ($resultBildirim) {
                                                             $adminNotfIDLer = array(1, $adminImplodeID);
                                                             $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                             $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                             }
                                                         }
                                                     } else {
                                                         $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                                         $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                         if ($resultBildirim) {
                                                             $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                             }
                                                         }
                                                     }
                                                 } else {
                                                     //üst admin
                                                     $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($yeniSilinen);
                                                     $adminIDCount = count($resultBolgeAdminID);
                                                     if ($adminIDCount > 0) {
                                                         for ($b = 0; $b < $adminIDCount; $b++) {
                                                             $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 31);
                                                         }
                                                         $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                         if ($resultBildirim) {
                                                             $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                             $adminNotfIDLer = array($adminImplodeID);
                                                             $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                             $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         } else {
                                             //fark yok sa demekki dizide değişiklik yok yani dizi ile ilgili düzenleme yapılmakta
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                             $aracRenk = 'warning';
                                             $aracUrl = 'aracliste';
                                             $aracIcon = 'fa fa-bus';
                                             //bildirim ayarları
                                             if ($adminRutbe != 1) {
                                                 //normal admin
                                                 $adminBolgeler = implode(',', $aracBolgeID);
                                                 $adminIDLer = array(1, $adminID);
                                                 $adminImplodeID = implode(',', $adminIDLer);
                                                 $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($adminBolgeler, $adminImplodeID);
                                                 $adminBolgeCount = count($resultAdminBolgeler);
                                                 if ($adminBolgeCount > 0) {
                                                     //diğer adminler
                                                     $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 51);
                                                     for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                         $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 51);
                                                     }
                                                     $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                     if ($resultBildirim) {
                                                         $adminNotfIDLer = array(1, $adminImplodeID);
                                                         $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                         $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                         }
                                                     }
                                                 } else {
                                                     $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 51);
                                                     $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                     if ($resultBildirim) {
                                                         $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                         }
                                                     }
                                                 }
                                             } else {
                                                 //üst admin
                                                 $adminBolgeler = implode(',', $aracBolgeID);
                                                 $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($adminBolgeler);
                                                 $adminIDCount = count($resultBolgeAdminID);
                                                 if ($adminIDCount > 0) {
                                                     for ($b = 0; $b < $adminIDCount; $b++) {
                                                         $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 51);
                                                     }
                                                     $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                     if ($resultBildirim) {
                                                         $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                         $adminNotfIDLer = array($adminImplodeID);
                                                         $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                         $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     } else {
                                         $bolgeIDEklenen = array_diff($aracBolgeID, $aracEskiBolgeID);
                                         if (count($bolgeIDEklenen) > 0) {
                                             //fark var
                                             $yeniEklenen = implode(",", $bolgeIDEklenen);
                                             //yeni eklenen bölge ayarı
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracEkleme"];
                                             $aracRenk = 'success';
                                             $aracUrl = 'aracliste';
                                             $aracIcon = 'fa fa-bus';
                                             //bildirim ayarları
                                             if ($adminRutbe != 1) {
                                                 //normal admin
                                                 $adminIDLer = array(1, $adminID);
                                                 $adminImplodeID = implode(',', $adminIDLer);
                                                 $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($yeniEklenen, $adminImplodeID);
                                                 $adminBolgeCount = count($resultAdminBolgeler);
                                                 if ($adminBolgeCount > 0) {
                                                     //diğer adminler
                                                     $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 11);
                                                     for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                         $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 11);
                                                     }
                                                     $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                     if ($resultBildirim) {
                                                         $adminNotfIDLer = array(1, $adminImplodeID);
                                                         $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                         $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                         }
                                                     }
                                                 } else {
                                                     $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 11);
                                                     $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                     if ($resultBildirim) {
                                                         $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                         }
                                                     }
                                                 }
                                             } else {
                                                 //üst admin
                                                 $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($yeniEklenen);
                                                 $adminIDCount = count($resultBolgeAdminID);
                                                 if ($adminIDCount > 0) {
                                                     for ($b = 0; $b < $adminIDCount; $b++) {
                                                         $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 11);
                                                     }
                                                     $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                     if ($resultBildirim) {
                                                         $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                         $adminNotfIDLer = array($adminImplodeID);
                                                         $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                         $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracEkle"]);
                                                         }
                                                     }
                                                 }
                                             }
                                             $bolgeIDSilinen = array_diff($aracEskiBolgeID, $aracBolgeID);
                                             if (count($bolgeIDSilinen) > 0) {
                                                 $yeniSilinen = implode(",", $bolgeIDSilinen);
                                                 //bölgeden araç silindi
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $deger["AracSilme"];
                                                 $aracRenk = 'danger';
                                                 $aracUrl = 'aracliste';
                                                 $aracIcon = 'fa fa-bus';
                                                 //bildirim ayarları
                                                 if ($adminRutbe != 1) {
                                                     //normal admin
                                                     $adminIDLer = array(1, $adminID);
                                                     $adminImplodeID = implode(',', $adminIDLer);
                                                     $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($yeniSilinen, $adminImplodeID);
                                                     $adminBolgeCount = count($resultAdminBolgeler);
                                                     if ($adminBolgeCount > 0) {
                                                         //diğer adminler
                                                         $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                                         for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                             $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 31);
                                                         }
                                                         $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                         if ($resultBildirim) {
                                                             $adminNotfIDLer = array(1, $adminImplodeID);
                                                             $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                             $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                             }
                                                         }
                                                     } else {
                                                         $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                                         $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                         if ($resultBildirim) {
                                                             $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                             }
                                                         }
                                                     }
                                                 } else {
                                                     //üst admin
                                                     $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($yeniSilinen);
                                                     $adminIDCount = count($resultBolgeAdminID);
                                                     if ($adminIDCount > 0) {
                                                         for ($b = 0; $b < $adminIDCount; $b++) {
                                                             $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 31);
                                                         }
                                                         $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                         if ($resultBildirim) {
                                                             $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                             $adminNotfIDLer = array($adminImplodeID);
                                                             $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                             $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                             if (count($resultAdminCihaz) > 0) {
                                                                 foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                     $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                                 }
                                                                 $adminCihaz = implode(',', $adminCihaz);
                                                                 $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracSil"]);
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         } else {
                                             //fark yok sa demekki dizide değişiklik yok yani dizi ile ilgili düzenleme yapılmakta
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                             $aracRenk = 'warning';
                                             $aracUrl = 'aracliste';
                                             $aracIcon = 'fa fa-bus';
                                             //bildirim ayarları
                                             if ($adminRutbe != 1) {
                                                 //normal admin
                                                 $adminBolgeler = implode(',', $aracBolgeID);
                                                 $adminIDLer = array(1, $adminID);
                                                 $adminImplodeID = implode(',', $adminIDLer);
                                                 $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($adminBolgeler, $adminImplodeID);
                                                 $adminBolgeCount = count($resultAdminBolgeler);
                                                 if ($adminBolgeCount > 0) {
                                                     //diğer adminler
                                                     $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 51);
                                                     for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                         $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 51);
                                                     }
                                                     $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                     if ($resultBildirim) {
                                                         $adminNotfIDLer = array(1, $adminImplodeID);
                                                         $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                         $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                         }
                                                     }
                                                 } else {
                                                     $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 51);
                                                     $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                     if ($resultBildirim) {
                                                         $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                         }
                                                     }
                                                 }
                                             } else {
                                                 //üst admin
                                                 $adminBolgeler = implode(',', $aracBolgeID);
                                                 $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($adminBolgeler);
                                                 $adminIDCount = count($resultBolgeAdminID);
                                                 if ($adminIDCount > 0) {
                                                     for ($b = 0; $b < $adminIDCount; $b++) {
                                                         $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 51);
                                                     }
                                                     $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                     if ($resultBildirim) {
                                                         $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                         $adminNotfIDLer = array($adminImplodeID);
                                                         $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                         $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                         if (count($resultAdminCihaz) > 0) {
                                                             foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                                 $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                             }
                                                             $adminCihaz = implode(',', $adminCihaz);
                                                             $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                     //yeni şoför eski şoför farkları varsa
                                     if (count($aracSoforID) >= count($aracEskiSoforID)) {
                                         $soforIDEklenen = array_diff($aracSoforID, $aracEskiSoforID);
                                         if (count($soforIDEklenen) > 0) {
                                             //fark var
                                             //yeni şoför eklenmiş
                                             $yeniEklenen = implode(",", $soforIDEklenen);
                                             //şoföre bildirim gönderme
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracAtama"];
                                             $resultSoforCihaz = $Panel_Model->soforCihaz($yeniEklenen);
                                             if (count($resultSoforCihaz) > 0) {
                                                 foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                     $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                                 }
                                                 $soforCihazlar = implode(',', $soforCihaz);
                                                 $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracAta"]);
                                             }
                                             $soforIDSilinen = array_diff($aracEskiSoforID, $aracSoforID);
                                             if (count($soforIDSilinen) > 0) {
                                                 $yeniSilinen = implode(",", $soforIDSilinen);
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracCıkarma"];
                                                 $resultSoforCihaz = $Panel_Model->soforCihaz($yeniSilinen);
                                                 if (count($resultSoforCihaz) > 0) {
                                                     foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                         $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                                     }
                                                     $soforCihazlar = implode(',', $soforCihaz);
                                                     $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracSil"]);
                                                 }
                                             }
                                         } else {
                                             //fark yok sa demekki dizide değişiklik yok yani dizi ile ilgili düzenleme yapılmakta
                                             $yeniDuzenlenen = implode(",", $aracSoforID);
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                             $resultSoforCihaz = $Panel_Model->soforCihaz($yeniDuzenlenen);
                                             if (count($resultSoforCihaz) > 0) {
                                                 foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                     $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                                 }
                                                 $soforCihazlar = implode(',', $soforCihaz);
                                                 $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracDuzen"]);
                                             }
                                         }
                                     } else {
                                         $soforIDEklenen = array_diff($aracSoforID, $aracEskiSoforID);
                                         if (count($soforIDEklenen) > 0) {
                                             //fark var
                                             $yeniEklenen = implode(",", $soforIDEklenen);
                                             //şoföre bildirim gönderme
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracAtama"];
                                             $resultSoforCihaz = $Panel_Model->soforCihaz($yeniEklenen);
                                             if (count($resultSoforCihaz) > 0) {
                                                 foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                     $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                                 }
                                                 $soforCihazlar = implode(',', $soforCihaz);
                                                 $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracAta"]);
                                             }
                                             $soforIDSilinen = array_diff($aracEskiSoforID, $aracSoforID);
                                             if (count($soforIDSilinen) > 0) {
                                                 $yeniSilinen = implode(",", $soforIDSilinen);
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracCıkarma"];
                                                 $resultSoforCihaz = $Panel_Model->soforCihaz($yeniSilinen);
                                                 if (count($resultSoforCihaz) > 0) {
                                                     foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                         $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                                     }
                                                     $soforCihazlar = implode(',', $soforCihaz);
                                                     $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracSil"]);
                                                 }
                                             }
                                         } else {
                                             //fark yok sa demekki dizide değişiklik yok yani dizi ile ilgili düzenleme yapılmakta
                                             $yeniDuzenlenen = implode(",", $aracSoforID);
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                             $resultSoforCihaz = $Panel_Model->soforCihaz($yeniDuzenlenen);
                                             if (count($resultSoforCihaz) > 0) {
                                                 foreach ($resultSoforCihaz as $resultSoforCihazz) {
                                                     $soforCihaz[] = $resultSoforCihazz['sbsoforcihazRecID'];
                                                 }
                                                 $soforCihazlar = implode(',', $soforCihaz);
                                                 $form->shuttleNotification($soforCihazlar, $alert, $degerbildirim["AracDuzen"]);
                                             }
                                         }
                                     }
                                     //yeni hostes eski hostes farkları varsa
                                     if (count($aracHostesID) >= count($aracEskiHostesID)) {
                                         $hostesIDEklenen = array_diff($aracHostesID, $aracEskiHostesID);
                                         if (count($hostesIDEklenen) > 0) {
                                             //fark var
                                             //yeni hostes eklenmiş
                                             $yeniEklenen = implode(",", $hostesIDEklenen);
                                             //hostese bildirim gönderme
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracAtama"];
                                             $resultHostesCihaz = $Panel_Model->hostesCihaz($yeniEklenen);
                                             if (count($resultHostesCihaz) > 0) {
                                                 foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                     $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                                 }
                                                 $hostesCihazlar = implode(',', $hostesCihaz);
                                                 $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracAta"]);
                                             }
                                             $hostesIDSilinen = array_diff($aracEskiHostesID, $aracHostesID);
                                             if (count($hostesIDSilinen) > 0) {
                                                 $yeniSilinen = implode(",", $hostesIDSilinen);
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracCıkarma"];
                                                 $resultHostesCihaz = $Panel_Model->hostesCihaz($yeniSilinen);
                                                 if (count($resultHostesCihaz) > 0) {
                                                     foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                         $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                                     }
                                                     $hostesCihazlar = implode(',', $hostesCihaz);
                                                     $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracSil"]);
                                                 }
                                             }
                                         } else {
                                             //fark yok sa demekki dizide değişiklik yok yani dizi ile ilgili düzenleme yapılmakta
                                             $yeniDuzenlenen = implode(",", $aracHostesID);
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                             $resultHostesCihaz = $Panel_Model->hostesCihaz($yeniDuzenlenen);
                                             if (count($resultHostesCihaz) > 0) {
                                                 foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                     $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                                 }
                                                 $hostesCihazlar = implode(',', $hostesCihaz);
                                                 $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracDuzen"]);
                                             }
                                         }
                                     } else {
                                         $hostesIDEklenen = array_diff($aracHostesID, $aracEskiHostesID);
                                         if (count($hostesIDEklenen) > 0) {
                                             //fark var
                                             $yeniEklenen = implode(",", $hostesIDEklenen);
                                             //şoföre bildirim gönderme
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracAtama"];
                                             $resultHostesCihaz = $Panel_Model->hostesCihaz($yeniEklenen);
                                             if (count($resultHostesCihaz) > 0) {
                                                 foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                     $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                                 }
                                                 $hostesCihazlar = implode(',', $hostesCihaz);
                                                 $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracAta"]);
                                             }
                                             $hostesIDSilinen = array_diff($aracEskiHostesID, $aracHostesID);
                                             if (count($hostesIDSilinen) > 0) {
                                                 $yeniSilinen = implode(",", $hostesIDSilinen);
                                                 $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracCıkarma"];
                                                 $resultHostesCihaz = $Panel_Model->soforCihaz($yeniSilinen);
                                                 if (count($resultHostesCihaz) > 0) {
                                                     foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                         $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                                     }
                                                     $hostesCihazlar = implode(',', $hostesCihaz);
                                                     $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracSil"]);
                                                 }
                                             }
                                         } else {
                                             //fark yok sa demekki dizide değişiklik yok yani dizi ile ilgili düzenleme yapılmakta
                                             $yeniDuzenlenen = implode(",", $aracHostesID);
                                             $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                             $resultHostesCihaz = $Panel_Model->soforCihaz($yeniDuzenlenen);
                                             if (count($resultHostesCihaz) > 0) {
                                                 foreach ($resultHostesCihaz as $resultHostesCihazz) {
                                                     $hostesCihaz[] = $resultHostesCihazz['bshostescihazRecID'];
                                                 }
                                                 $hostesCihazlar = implode(',', $hostesCihaz);
                                                 $form->shuttleNotification($hostesCihazlar, $alert, $degerbildirim["AracDuzen"]);
                                             }
                                         }
                                     }
                                     //düzenleme yapılırken ortak bölge id leri için
                                     $bolgeIDOrtak = array_intersect($aracBolgeID, $aracEskiBolgeID);
                                     if (count($bolgeIDOrtak) > 0) {
                                         $yeniOrtakBolge = implode(",", $bolgeIDOrtak);
                                         //bölgeden araç düzenleme
                                         $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                         $aracRenk = 'warning';
                                         $aracUrl = 'aracliste';
                                         $aracIcon = 'fa fa-bus';
                                         //bildirim ayarları
                                         if ($adminRutbe != 1) {
                                             //normal admin
                                             $adminIDLer = array(1, $adminID);
                                             $adminImplodeID = implode(',', $adminIDLer);
                                             $resultAdminBolgeler = $Panel_Model->digerOrtakBolge($yeniOrtakBolge, $adminImplodeID);
                                             $adminBolgeCount = count($resultAdminBolgeler);
                                             if ($adminBolgeCount > 0) {
                                                 //diğer adminler
                                                 $multiData[0] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                                 for ($b = 0; $b < $adminBolgeCount; $b++) {
                                                     $multiData[$b + 1] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultAdminBolgeler[$b]['BSAdminID'], 31);
                                                 }
                                                 $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                 if ($resultBildirim) {
                                                     $adminNotfIDLer = array(1, $adminImplodeID);
                                                     $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                     $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                     if (count($resultAdminCihaz) > 0) {
                                                         foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                             $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                         }
                                                         $adminCihaz = implode(',', $adminCihaz);
                                                         $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                     }
                                                 }
                                             } else {
                                                 $dataBildirim = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, 1, 31);
                                                 $resultBildirim = $Panel_Model->addNewAdminBildirim($dataBildirim);
                                                 if ($resultBildirim) {
                                                     $resultAdminCihaz = $Panel_Model->adminCihaz();
                                                     if (count($resultAdminCihaz) > 0) {
                                                         foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                             $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                         }
                                                         $adminCihaz = implode(',', $adminCihaz);
                                                         $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                     }
                                                 }
                                             }
                                         } else {
                                             //üst admin
                                             $resultBolgeAdminID = $Panel_Model->ortakDigerAdminBolge($yeniOrtakBolge);
                                             $adminIDCount = count($resultBolgeAdminID);
                                             if ($adminIDCount > 0) {
                                                 for ($b = 0; $b < $adminIDCount; $b++) {
                                                     $multiData[$b] = $form->adminBildirimDuzen($alert, $aracIcon, $aracUrl, $aracRenk, $adminID, $adSoyad, $resultBolgeAdminID[$b]['BSAdminID'], 31);
                                                 }
                                                 $resultBildirim = $Panel_Model->addNewAdminMultiBildirim($multiData);
                                                 if ($resultBildirim) {
                                                     $adminImplodeID = implode(',', $resultBolgeAdminID);
                                                     $adminNotfIDLer = array($adminImplodeID);
                                                     $adminImplodeNtf = implode(',', $adminNotfIDLer);
                                                     $resultAdminCihaz = $Panel_Model->digerAdminCihaz($adminImplodeNtf);
                                                     if (count($resultAdminCihaz) > 0) {
                                                         foreach ($resultAdminCihaz as $resultAdminCihazz) {
                                                             $adminCihaz[] = $resultAdminCihazz['bsadmincihazRecID'];
                                                         }
                                                         $adminCihaz = implode(',', $adminCihaz);
                                                         $form->shuttleNotification($adminCihaz, $alert, $degerbildirim["AracDuzen"]);
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                     $alert = $adSoyad . ' ' . $aracPlaka . $degerbildirim["AracDuzenleme"];
                                     //log ayarları
                                     $dataLog = $form->adminBildirimLogDuzen($adminID, $adSoyad, $alert);
                                     $resultLog = $Panel_Model->addNewAdminBildirimLog($dataLog);
                                     if ($resultLog) {
                                         $sonuc["newAracID"] = $aracID;
                                         $sonuc["update"] = $deger["AracDuzenle"];
                                     } else {
                                         $sonuc["hata"] = $deger["Hata"];
                                     }
                                 } else {
                                     $sonuc["hata"] = $deger["Hata"];
                                 }
                             } else {
                                 $sonuc["hata"] = $deger["Hata"];
                             }
                         }
                     } else {
                         $sonuc["hata"] = $deger["Hata"];
                     }
                 }
             case "adminAracDetailTur":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $form->post('aracID', true);
                     $adminAracDetailID = $form->values['aracID'];
                     $adminAracTurDetail = $Panel_Model->adminAracTurDetail($adminAracDetailID);
                     //arac TUR İD
                     $a = 0;
                     foreach ($adminAracTurDetail as $adminAracTurDetaill) {
                         $aracturId[] = $adminAracTurDetaill['BSTurID'];
                         $a++;
                     }
                     $turId = implode(',', $aracturId);
                     $aracTur = $Panel_Model->adminAracDetailTur($turId);
                     $b = 0;
                     foreach ($aracTur as $aracTurr) {
                         $aracDetailTur[$b]['TurID'] = $aracTurr['SBTurID'];
                         $aracDetailTur[$b]['TurAd'] = $aracTurr['SBTurAd'];
                         $aracDetailTur[$b]['TurAciklama'] = $aracTurr['SBTurAciklama'];
                         $aracDetailTur[$b]['TurAktiflik'] = $aracTurr['SBTurAktiflik'];
                         $aracDetailTur[$b]['TurKurum'] = $aracTurr['SBKurumAd'];
                         $aracDetailTur[$b]['TurTip'] = $aracTurr['SBTurTip'];
                         $aracDetailTur[$b]['TurBolge'] = $aracTurr['SBBolgeAd'];
                         $b++;
                     }
                     $sonuc["aracDetailTur"] = $aracDetailTur;
                 }
                 break;
             case "AracDetailMultiSelect":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $aracDetailBolgeID = $_REQUEST['aracDetailBolgeID'];
                     $form->post('aracID', true);
                     $aracID = $form->values['aracID'];
                     //araca ait şoförler
                     $adminAracSofor = $Panel_Model->aracDetailMultiSelectSofor($aracID);
                     if (count($adminAracSofor) > 0) {
                         $a = 0;
                         foreach ($adminAracSofor as $adminAracSoforr) {
                             $aracsoforId[] = $adminAracSoforr['BSSoforID'];
                             $a++;
                         }
                         //araca ait şoförler
                         $aracbolgesofor = implode(',', $aracsoforId);
                         //seçilen bölgeler
                         $aracbolgedizim = implode(',', $aracDetailBolgeID);
                         //seçilen bölgedeki şoförler
                         $adminAracBolgeSofor = $Panel_Model->adminSelectBolgeSoforr($aracbolgedizim);
                         $b = 0;
                         foreach ($adminAracBolgeSofor as $adminAracBolgeSoforr) {
                             $aracDigerSoforId[] = $adminAracBolgeSoforr['BSSoforID'];
                             $b++;
                         }
                         //gelen şoför ıdlerinde aynı olan idler, seçili şoförlerdir.
                         $ortakIDler = array_intersect($aracsoforId, $aracDigerSoforId);
                         //gelen idlerde ki farklı olanlar seçili olmayan şoförlerdir yani diğer şoförler
                         $sofor_fark = array_diff($aracDigerSoforId, $aracsoforId);
                         $diger_sofor_fark = implode(',', $sofor_fark);
                         //ortak ıd ye sahip şoför varmı
                         if (count($ortakIDler) > 0) {
                             //seçili şoförler
                             $secilenIdSofor = implode(',', $ortakIDler);
                             $selectBolgeSofor = $Panel_Model->adminDetailAracNotSelectSofor($secilenIdSofor);
                             $c = 0;
                             foreach ($selectBolgeSofor as $selectBolgeSoforr) {
                                 $selectAracSofor[$c]['SelectAracSoforID'] = $selectBolgeSoforr['BSSoforID'];
                                 $selectAracSofor[$c]['SelectAracSoforAd'] = $selectBolgeSoforr['BSSoforAd'];
                                 $selectAracSofor[$c]['SelectAracSoforSoyad'] = $selectBolgeSoforr['BSSoforSoyad'];
                                 $c++;
                             }
                             //diğer şoförler
                             $digerBolgeSofor = $Panel_Model->adminDetailAracNotSelectSofor($diger_sofor_fark);
                             $d = 0;
                             foreach ($digerBolgeSofor as $digerBolgeSoforr) {
                                 $digerAracSofor[$d]['DigerAracSoforID'] = $digerBolgeSoforr['BSSoforID'];
                                 $digerAracSofor[$d]['DigerAracSoforAdi'] = $digerBolgeSoforr['BSSoforAd'];
                                 $digerAracSofor[$d]['DigerAracSoforSoyad'] = $digerBolgeSoforr['BSSoforSoyad'];
                                 $d++;
                             }
                         } else {
                             //ortak id yoksa seçili şoför yoktur
                             //diğer şoförler
                             $digerBolgeSofor = $Panel_Model->adminDetailAracNotSelectSofor($diger_sofor_fark);
                             $d = 0;
                             foreach ($digerBolgeSofor as $digerBolgeSoforr) {
                                 $digerAracSofor[$d]['DigerAracSoforID'] = $digerBolgeSoforr['BSSoforID'];
                                 $digerAracSofor[$d]['DigerAracSoforAdi'] = $digerBolgeSoforr['BSSoforAd'];
                                 $digerAracSofor[$d]['DigerAracSoforSoyad'] = $digerBolgeSoforr['BSSoforSoyad'];
                                 $d++;
                             }
                         }
                     } else {
                         $aracDetailBollgeID = implode(',', $aracDetailBolgeID);
                         //adamın seçili olab bölgedeki diğer şoförleri
                         $adminAracBolgeSofor = $Panel_Model->adminSelectBolgeSoforr($aracDetailBollgeID);
                         $g = 0;
                         foreach ($adminAracBolgeSofor as $adminAracBolgeSoforr) {
                             $aracDigerSoforId[] = $adminAracBolgeSoforr['BSSoforID'];
                             $g++;
                         }
                         $aracSelectDigerSoforId = implode(',', $aracDigerSoforId);
                         //aracın bolgesi dışındakiler
                         $digerBolgeSofor = $Panel_Model->adminDetailAracBolgeSofor($aracSelectDigerSoforId);
                         $d = 0;
                         foreach ($digerBolgeSofor as $digerBolgeSoforr) {
                             $digerAracSofor[$d]['DigerAracSoforID'] = $digerBolgeSoforr['BSSoforID'];
                             $digerAracSofor[$d]['DigerAracSoforAdi'] = $digerBolgeSoforr['BSSoforAd'];
                             $digerAracSofor[$d]['DigerAracSoforSoyad'] = $digerBolgeSoforr['BSSoforSoyad'];
                             $d++;
                         }
                     }
                     //araca ait hostesler
                     $adminAracHostes = $Panel_Model->aracDetailMultiSelectHostes($aracID);
                     if (count($adminAracHostes) > 0) {
                         $a = 0;
                         foreach ($adminAracHostes as $adminAracHostess) {
                             $arachostesId[] = $adminAracHostess['BSHostesID'];
                             $a++;
                         }
                         //araca ait şoförler
                         $aracbolgesofor = implode(',', $arachostesId);
                         //seçilen bölgeler
                         $aracbolgedizim = implode(',', $aracDetailBolgeID);
                         //seçilen bölgedeki hostesler
                         $adminAracBolgeHostes = $Panel_Model->adminSelectBolgeHostess($aracbolgedizim);
                         $b = 0;
                         foreach ($adminAracBolgeHostes as $adminAracBolgeHostess) {
                             $aracDigerHostesId[] = $adminAracBolgeHostess['BSHostesID'];
                             $b++;
                         }
                         //gelen şoför ıdlerinde aynı olan idler, seçili hosteslerdir.
                         $ortakIDler = array_intersect($arachostesId, $aracDigerHostesId);
                         //gelen idlerde ki farklı olanlar seçili olmayan hosteslerdir yani diğer hostesler
                         $hostes_fark = array_diff($aracDigerHostesId, $arachostesId);
                         $diger_hostes_fark = implode(',', $hostes_fark);
                         //ortak ıd ye sahip hostes varmı
                         if (count($ortakIDler) > 0) {
                             //seçili hostes
                             $secilenIdHostes = implode(',', $ortakIDler);
                             $selectBolgeHostes = $Panel_Model->adminDetailAracNotSelectHostes($secilenIdHostes);
                             $c = 0;
                             foreach ($selectBolgeHostes as $selectBolgeHostess) {
                                 $selectAracHostes[$c]['SelectAracHostesID'] = $selectBolgeHostess['BSHostesID'];
                                 $selectAracHostes[$c]['SelectAracHostesAd'] = $selectBolgeHostess['BSHostesAd'];
                                 $selectAracHostes[$c]['SelectAracHostesSoyad'] = $selectBolgeHostess['BSHostesSoyad'];
                                 $c++;
                             }
                             //diğer hostesler
                             $digerBolgeHostes = $Panel_Model->adminDetailAracNotSelectHostes($diger_hostes_fark);
                             $d = 0;
                             foreach ($digerBolgeHostes as $digerBolgeHostess) {
                                 $digerAracHostes[$d]['DigerAracHostesID'] = $digerBolgeHostess['BSHostesID'];
                                 $digerAracHostes[$d]['DigerAracHostesAdi'] = $digerBolgeHostess['BSHostesAd'];
                                 $digerAracHostes[$d]['DigerAracHostesSoyad'] = $digerBolgeHostess['BSHostesSoyad'];
                                 $d++;
                             }
                         } else {
                             //ortak id yoksa seçili hostes yoktur
                             //diğer hostesler
                             $digerBolgeHostes = $Panel_Model->adminDetailAracNotSelectHostes($diger_hostes_fark);
                             $d = 0;
                             foreach ($digerBolgeHostes as $digerBolgeHostess) {
                                 $digerAracHostes[$d]['DigerAracHostesID'] = $digerBolgeHostess['BSHostesID'];
                                 $digerAracHostes[$d]['DigerAracHostesAdi'] = $digerBolgeHostess['BSHostesAd'];
                                 $digerAracHostes[$d]['DigerAracHostesSoyad'] = $digerBolgeHostess['BSHostesSoyad'];
                                 $d++;
                             }
                         }
                     } else {
                         $aracDetailBollgeID = implode(',', $aracDetailBolgeID);
                         //adamın seçili olab bölgedeki diğer hostesleri
                         $adminAracBolgeHostes = $Panel_Model->adminSelectBolgeHostess($aracDetailBollgeID);
                         $g = 0;
                         foreach ($adminAracBolgeHostes as $adminAracBolgeHostess) {
                             $aracDigerHostesId[] = $adminAracBolgeHostess['BSHostesID'];
                             $g++;
                         }
                         $aracSelectDigerSoforId = implode(',', $aracDigerHostesId);
                         //aracın bolgesi dışındakiler
                         $digerBolgeHostes = $Panel_Model->adminDetailAracBolgeHostes($aracSelectDigerSoforId);
                         $d = 0;
                         foreach ($digerBolgeHostes as $digerBolgeHostess) {
                             $digerAracHostes[$d]['DigerAracHostesID'] = $digerBolgeHostess['BSHostesID'];
                             $digerAracHostes[$d]['DigerAracHostesAdi'] = $digerBolgeHostess['BSHostesAd'];
                             $digerAracHostes[$d]['DigerAracHostesSoyad'] = $digerBolgeHostess['BSHostesSoyad'];
                             $d++;
                         }
                     }
                     //sonuçlar
                     $sonuc["adminAracSelectSofor"] = $selectAracSofor;
                     $sonuc["adminAracSelectHostes"] = $selectAracHostes;
                     $sonuc["adminAracSofor"] = $digerAracSofor;
                     $sonuc["adminAracHostes"] = $digerAracHostes;
                 }
                 break;
             case "AracSoforMultiSelect":
                 $adminID = Session::get("userId");
                 if (!$adminID) {
                     header("Location:" . SITE_URL_LOGOUT);
                 } else {
                     $aracBolgeID = $_REQUEST['aracBolgeID'];
                     $multisofordizi = implode(',', $aracBolgeID);
                     $soforBolgeListe = $Panel_Model->aracDetailMultiSelectBolgee($multisofordizi);
                     foreach ($soforBolgeListe as $soforBolgeListee) {
                         $soforrutbeId[] = $soforBolgeListee['BSSoforID'];
                     }
                     $rutbesofordizi = implode(',', $soforrutbeId);
                     //bölgeleri getirir
                     $soforListe = $Panel_Model->soforMultiSelectt($rutbesofordizi);
                     $a = 0;
                     foreach ($soforListe as $soforListee) {
                         $aracSoforSelect['SoforSelectID'][$a] = $soforListee['BSSoforID'];
                         $aracSoforSelect['SoforSelectAd'][$a] = $soforListee['BSSoforAd'];
                         $aracSoforSelect['SoforSelectSoyad'][$a] = $soforListee['BSSoforSoyad'];
                         $a++;
                     }
                     //hostes bilgileri
                     $hostesBolgeListe = $Panel_Model->aracDetailHostesMultiSelectBolgee($multisofordizi);
                     foreach ($hostesBolgeListe as $hostesBolgeListee) {
                         $hostesrutbeId[] = $hostesBolgeListee['BSHostesID'];
                     }
                     $rutbehostesdizi = implode(',', $hostesrutbeId);
                     //bölgeleri getirir
                     $hostesListe = $Panel_Model->hostesMultiSelectt($rutbehostesdizi);
                     $a = 0;
                     foreach ($hostesListe as $hostesListee) {
                         $aracHostesSelect['HostesSelectID'][$a] = $hostesListee['BSHostesID'];
                         $aracHostesSelect['HostesSelectAd'][$a] = $hostesListee['BSHostesAd'];
                         $aracHostesSelect['HostesSelectSoyad'][$a] = $hostesListee['BSHostesSoyad'];
                         $a++;
                     }
                     $sonuc["aracYeniSoforMultiSelect"] = $aracSoforSelect;
                     $sonuc["aracYeniHostesMultiSelect"] = $aracHostesSelect;
                 }
                 break;
             case "adminAracTakvim":
                 $calendar = $this->load->otherClasses('Calendar');
                 // Short-circuit if the client did not give us a date range.
                 if (!isset($_POST['start']) || !isset($_POST['end'])) {
                     error_log("die");
                     die("Please provide a date range.");
                 }
                 // Parse the start/end parameters.
                 // These are assumed to be ISO8601 strings with no time nor timezone, like "2013-12-29".
                 // Since no timezone will be present, they will parsed as UTC.
                 $range_start = parseDateTime($_POST['start']);
                 $range_end = parseDateTime($_POST['end']);
                 // Parse the timezone parameter if it is present.
                 $timezone = null;
                 if (isset($_POST['timezone'])) {
                     $timezone = new DateTimeZone($_POST['timezone']);
                 }
                 $form->post("id", true);
                 $id = $form->values['id'];
                 $adminAracTakvim = $Panel_Model->adminAracTakvim($id);
                 $a = 0;
                 foreach ($adminAracTakvim as $adminAracTakvimm) {
                     $tkvimID[$a] = $adminAracTakvimm['BSTurID'];
                     $aracTkvim[$a]['Pzt'] = $adminAracTakvimm['SBTurPzt'];
                     $aracTkvim[$a]['Sli'] = $adminAracTakvimm['SBTurSli'];
                     $aracTkvim[$a]['Crs'] = $adminAracTakvimm['SBTurCrs'];
                     $aracTkvim[$a]['Prs'] = $adminAracTakvimm['SBTurPrs'];
                     $aracTkvim[$a]['Cma'] = $adminAracTakvimm['SBTurCma'];
                     $aracTkvim[$a]['Cmt'] = $adminAracTakvimm['SBTurCmt'];
                     $aracTkvim[$a]['Pzr'] = $adminAracTakvimm['SBTurPzr'];
                     $aracTkvim[$a]['Bslngc'] = $adminAracTakvimm['BSTurBslngc'];
                     $aracTkvim[$a]['Bts'] = $adminAracTakvimm['BSTurBts'];
                     $a++;
                 }
                 $count = count($tkvimID);
                 foreach ($tkvimID as $value) {
                     $sql .= 'SELECT SBTurAd FROM sbtur WHERE SBTurID=' . $value . ' UNION ALL ';
                 }
                 $uzunluk = strlen($sql);
                 $uzunluk = $uzunluk - 10;
                 $sqlTitle = substr($sql, 0, $uzunluk);
                 $takvimTitle = $Panel_Model->takvimTitle($sqlTitle);
                 $c = 0;
                 foreach ($takvimTitle as $takvimTitlee) {
                     $title[$c] = $takvimTitlee['SBTurAd'];
                     $c++;
                 }
                 $input_arrays = [];
                 $input_arrays = $form->calendar($aracTkvim, $title);
                 // Accumulate an output array of event data arrays.
                 //                    foreach ($input_arrays as $array) {
                 //
                 //                        // Convert the input array into a useful Event object
                 //                        $event = new Calendar($array, $timezone);
                 //
                 //                        // If the event is in-bounds, add it to the output
                 //                        if ($event->isWithinDayRange($range_start, $range_end)) {
                 //                            //$sonuc[] = $event->toArray();
                 //                        }
                 //                    }
                 $sonuc = $input_arrays;
                 break;
             default:
                 header("Location:" . SITE_URL_LOGOUT);
                 break;
         }
         echo json_encode($sonuc);
     } else {
         header("Location:" . SITE_URL_LOGOUT);
     }
 }
    public function _getHTML()
    {
        $self = basename($_SERVER['PHP_SELF']);
        $this->loadRecord();
        if ($this->id) {
            $qs = "?pv={$this->id}&pp={$this->pid}";
            $tname = $value = htmlspecialchars($this->record->Value);
            $extradata = htmlspecialchars($this->record->ExtraData);
            $desc = str_replace("\r\n", "\r", htmlspecialchars($this->record->Description));
            $dt = parseDateTime($this->record->LastChange);
            $lastchange = date('j.n. Y - H:i', $dt['stamp']);
        } else {
            $qs = "?pp={$this->pid}";
            $value = '';
            $tname = 'neu';
            $extradata = '';
            $desc = '';
            $lastchange = null;
        }
        $property = htmlspecialchars($this->property);
        if ($this->read_only) {
            $readonly_str = ' readonly';
            $onchange_str = '';
            $ro_disabled_str = ' disabled';
            $D_str = 'D';
        } else {
            $readonly_str = $ro_disabled_str = $D_str = '';
            $onchange_str = ' onchange="Kiwi_ProductPropertyValue_Form.onChange()" onkeydown="return Kiwi_ProductPropertyValue_Form.onKeyDown(event)"';
        }
        $extradata_a = array(1 => '', 2 => 'Icon-Datei', 3 => 'Hex Color-Registrierung');
        $ed_title = $extradata_a[$this->record->DataType];
        $html = <<<EOT
<form enctype="multipart/form-data" action="{$self}{$qs}" method="post">
\t<h2>[Eigenschaft: {$property}] - {$tname} - [editieren]</h2>
\t<div class="levyV">
\t\t<div class="form3">
\t\t\t<fieldset>
\t\t\t\t<input type="hidden" id="kppvfc_datatype" name="Datovy_typ" value="{$this->record->DataType}" />
\t\t\t\t<input type="hidden" id="kppvfc_edtitle" value="{$ed_title}" />

EOT;
        if ($lastchange != null) {
            $html .= <<<EOT
\t\t\t\t<div class="zmena">Zuletzt Aktualisiert: {$lastchange}</div>

EOT;
        }
        $ed_html = '';
        if ($ed_title !== '') {
            $icon_html = '';
            if ($this->id) {
                $imgdir = KIWI_DIR_PRODUCTS . 'properties/';
                switch ($this->record->DataType) {
                    case PT_ICON:
                        if ($this->record->ExtraData !== '') {
                            $icon_html = <<<EOT
<img src="{$imgdir}icons/{$extradata}" title="{$extradata}" alt="{$tname}" />
EOT;
                            $ed_html = <<<EOT

\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td><span class="span-form2">{$ed_title} :</span></td>
\t\t\t\t\t\t\t<td>{$icon_html}<input type="button" id="kppvfc_cmd9" name="removeIcon" value="entfernen" class="but3{$D_str}" onclick="Kiwi_ProductPropertyValue_Form.onRemoveIcon('{$self}{$qs}')" {$ro_disabled_str}/></td>
\t\t\t\t\t\t</tr>
EOT;
                            //TODO: remove possibility
                        } else {
                            $ed_html = <<<EOT

\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td><span class="span-form2">{$ed_title} :</span></td>
\t\t\t\t\t\t\t<td><input type="file" id="kppvfc_extradata" name="Extra_data" class="inpOUT"{$onchange_str} /></td>
\t\t\t\t\t\t</tr>
EOT;
                        }
                        break;
                    case PT_COLOR:
                        $colors_a = array_map('strtolower', preg_split('/[,;\\|]/', $extradata));
                        $filename = implode('', $colors_a);
                        $icon_html = <<<EOT
<img src="{$imgdir}colors/{$filename}.gif" title="" alt="{$tname}" />
EOT;
                        $ed_html = <<<EOT

\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td><span class="span-form2">{$ed_title} :</span></td>
\t\t\t\t\t\t\t<td><input type="text" id="kppvfc_extradata" name="Extra_data" value="{$extradata}" class="inpOUT" onfocus="this.className='inpON'" onblur="this.className='inpOFF'"{$onchange_str}{$readonly_str} />&nbsp;{$icon_html}</td>
\t\t\t\t\t\t</tr>
EOT;
                        break;
                    default:
                        $ed_html = '';
                        break;
                }
            } else {
                switch ($this->record->DataType) {
                    case PT_ICON:
                        $ed_html = <<<EOT

\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td><span class="span-form2">{$ed_title} :</span></td>
\t\t\t\t\t\t\t<td><input type="file" id="kppvfc_extradata" name="Extra_data" class="inpOUT"{$onchange_str} /></td>
\t\t\t\t\t\t</tr>
EOT;
                        break;
                    case PT_COLOR:
                        $ed_html = <<<EOT

\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td><span class="span-form2">{$ed_title} :</span></td>
\t\t\t\t\t\t\t<td><input type="text" id="kppvfc_extradata" name="Extra_data" value="" class="inpOUT" onfocus="this.className='inpON'" onblur="this.className='inpOFF'"{$onchange_str}{$readonly_str} /></td>
\t\t\t\t\t\t</tr>
EOT;
                        break;
                    default:
                        $ed_html = '';
                        break;
                }
            }
        }
        $html .= <<<EOT
\t\t\t\t<div id="frame3">
\t\t\t\t\t<table class="tab-form" cellspacing="0" cellpadding="0">
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td><span class="span-form2">Wert der Eigenschaft :</span></td>
\t\t\t\t\t\t\t<td><input type="text" id="kppvfc_value" name="Hodnota_vlastnosti" value="{$value}" class="inpOUT" onfocus="this.className='inpON'" onblur="this.className='inpOFF'"{$onchange_str}{$readonly_str} /></td>
\t\t\t\t\t\t</tr>{$ed_html}
\t\t\t\t\t\t<tr>
\t\t\t\t\t\t\t<td><span class="span-form2">Wertbeschreibung :</span></td>
\t\t\t\t\t\t\t<td><textarea class="texarOUT" id="kppyfc_desc" name="Popis_hodnoty" onfocus="this.className='texarON'" onblur="this.className='texarOFF'"{$onchange_str}{$readonly_str}>{$desc}</textarea></td>
\t\t\t\t\t\t</tr>
\t\t\t\t\t</table>
\t\t\t\t</div>
\t\t\t\t<input type="submit" id="kppvfc_cmd1" name="cmd" value="speichern" class="but3D" disabled onclick="return Kiwi_ProductPropertyValue_Form.onSave()" />
\t\t\t</fieldset>
\t\t</div>
\t</div>
</form>

EOT;
        return $html;
    }
    public function _getHTML()
    {
        $this->loadLastChange();
        $this->loadProducts();
        $self = basename($_SERVER['PHP_SELF']);
        $qs = $this->consQS();
        $qsep = $qs ? '&' : '?';
        $html = <<<EOT
<form action="{$self}{$qs}" method="post">
\t<h2>KATALOG Artikel - [Liste]</h2>
\t<div class="levyV">

EOT;
        if ($this->lastchange != null) {
            $html .= <<<EOT
\t\t<div class="zmena">Zuletzt Aktualisiert: {$this->lastchange->format()}</div>

EOT;
        }
        $tabs_html = '';
        $tqs = $this->consQS(true, true);
        $tqsep = $tqs == '' ? '?' : '&';
        foreach ($this->fletters as $fletter => $flcount) {
            $fletterqs = urlencode($fletter);
            if ($this->letter == $fletter) {
                $tabs_html .= <<<EOT

\t\t\t<span title="{$flcount}">{$fletter}</span>
EOT;
            } elseif ($flcount == 0) {
                $tabs_html .= <<<EOT

\t\t\t<b>{$fletter}</b>
EOT;
            } else {
                $tabs_html .= <<<EOT

\t\t\t<a href="{$self}{$tqs}{$tqsep}l={$fletterqs}" title="{$flcount}">{$fletter}</a>
EOT;
            }
        }
        if ($this->letter === null) {
            $prod_count = sizeof($this->products);
        } else {
            $prod_count = array_key_exists($this->letter, $this->fletters) ? $this->fletters[$this->letter] : 0;
        }
        $pages = (int) ($prod_count / self::$records_per_page + 1);
        $pages_html = '';
        if ($pages > 1) {
            $pqs = $this->consQS(false, true);
            $pqs .= $pqs == '' ? '?' : '&';
            for ($pg = 1; $pg <= $pages; $pg++) {
                if ($pg == $this->page) {
                    $pages_html .= <<<EOT

\t\t\t<span>{$pg}</span>
EOT;
                } else {
                    $pages_html .= <<<EOT

\t\t\t<a href="{$self}{$pqs}pg={$pg}">{$pg}</a>
EOT;
                }
            }
        }
        $html .= <<<EOT
\t\t<div id="zalozky">{$tabs_html}

EOT;
        $totalcount = array_sum($this->fletters);
        if ($this->letter === null) {
            $html .= <<<EOT
\t\t\t<span title="{$totalcount}">Alles</span>

EOT;
        } else {
            $html .= <<<EOT
\t\t\t<a href="{$self}{$tqs}" title="{$totalcount}">Alles</a>

EOT;
        }
        $search = htmlspecialchars($this->getSearchBoxText());
        $html .= <<<EOT
\t\t<div class="searchbox">
\t\t\t<input type="text" id="kprfc_sbox" name="search" value="{$search}" class="searchinp" />
\t\t\t<!--[if IE]><input type="text" style="display: none;" disabled="disabled" size="1" /><![endif]-->
\t\t\t<input type="submit" id="kprfc_sbtn" name="cmd" value="suchen" class="searchbtn" />
\t\t</div>
\t\t<br class="clear" />
\t\t</div>

EOT;
        if ($pages_html !== '') {
            $html .= <<<EOT
\t\t<div id="stranky">Seite: {$pages_html}
\t\t\t<br class="clear" />
\t\t</div>

EOT;
        }
        $disabled_str = sizeof($this->products) == 0 ? ' disabled' : '';
        $all_checked_str = $this->all_checked ? ' checked' : '';
        $html .= <<<EOT
\t\t<div id="frame">
\t\t\t<table class="tab-seznam" cellspacing="0" cellpadding="0">
\t\t\t\t<tr>
\t\t\t\t\t<th><input type="checkbox" name="checkall" value="Vsechny"{$disabled_str} onclick="checkUncheckAll(document.getElementsByName('check[]'),this);Kiwi_Products_Form.enableBtns(false);"{$all_checked_str} /></th>
\t\t\t\t\t<th>Produkt</th>
\t\t\t\t\t<th>Preis</th>
\t\t\t\t\t<th><span title="Neu">N</span></th>
\t\t\t\t\t<th><span title="Aktion">Ak</span></th>
\t\t\t\t\t<th><span title="Rabatt">R</span></th>
\t\t\t\t\t<th><span title="Ausferkauf">Au</span></th>
\t\t\t\t\t<th>Nutzung</th>
\t\t\t\t\t<th></th>
\t\t\t\t\t<th>geändert</th>
\t\t\t\t\t<th>aktiv</th>
\t\t\t\t</tr>

EOT;
        $sw = 1;
        $next_sw = array(1 => 2, 2 => 1);
        $pi_end = $this->page * self::$records_per_page;
        $pi_start = $pi_end - self::$records_per_page + 1;
        $pi = 0;
        foreach ($this->products as $product) {
            if ($this->letter !== null) {
                $ltr = mb_strtoupper(mb_substr($product->Title, 0, 2));
                if ($ltr != 'CH') {
                    $ltr = $this->removeDiaT1(mb_substr($ltr, 0, 1));
                }
                if ($ltr != $this->letter) {
                    continue;
                }
            }
            $pi += 1;
            if ($pi < $pi_start || $pi > $pi_end) {
                continue;
            }
            $checked_str = isset($this->checked[$product->ID]) && $this->checked[$product->ID] ? ' checked' : '';
            if (mb_strlen($product->Title) > self::MAX_TITLE_LEN) {
                $title = htmlspecialchars(mb_substr($product->Title, 0, self::MAX_TITLE_LEN) . '...');
            } else {
                $title = htmlspecialchars($product->Title);
            }
            $plink = KIWI_EDIT_PRODUCT . "?p={$product->ID}";
            if ($this->eshop_item) {
                $plink .= "&sei={$this->eshop_item}";
            }
            $sqs = $this->saveQS();
            if ($sqs) {
                $plink .= "&sqs={$sqs}";
            }
            $anchor_str = $this->anchor->ID == $product->ID ? ' id="zmena"' : '';
            $new_cost = htmlspecialchars(sprintf("%01.2f", $product->NewCost));
            if ($product->Photo) {
                $photo = 'photoOK';
                $phototitle = 'Artikel mit Foto';
            } else {
                $photo = 'photoKO';
                $phototitle = 'Artikel ohne Foto';
            }
            $photostr = <<<EOT
<img src="./image/{$photo}.gif" alt="" title="{$phototitle}" />
EOT;
            $novelty = $product->Novelty != 0 ? 'ja' : 'nein';
            $action = $product->Action != 0 ? 'ja' : 'nein';
            $discount = $product->Discount != 0 ? 'ja' : 'nein';
            $sellout = $product->Sellout != 0 ? 'ja' : 'nein';
            if ($product->Usage) {
                $usage = $product->Usage;
                if ($product->Usage > $product->ActiveUsage) {
                    $aktivni = 'aktiv';
                    //if ($product->ActiveUsage > 4) $aktivni .= 'ch'; // only for czech lang
                    $usage .= " ({$product->ActiveUsage} {$aktivni})";
                }
            } else {
                $usage = '0';
            }
            $dt = parseDateTime($product->LastChange);
            $lastchange = date('j.n.Y H:i', $dt['stamp']);
            $active = $product->Active != 0 ? 'ja' : 'nein';
            $html .= <<<EOT
\t\t\t\t<tr class="t-s-{$sw}">
\t\t\t\t\t<td><input type="checkbox" name="check[]" value="{$product->ID}" onclick="Kiwi_Products_Form.enableBtns(this.checked)"{$checked_str} /></td>
\t\t\t\t\t<td><a href="{$plink}"{$anchor_str}>{$title}</a></td>
\t\t\t\t\t<td>{$new_cost}</td>
\t\t\t\t\t<td><a href="{$self}{$qs}{$qsep}tn={$product->ID}">{$novelty}</a></td>
\t\t\t\t\t<td><a href="{$self}{$qs}{$qsep}ta={$product->ID}">{$action}</a></td>
\t\t\t\t\t<td><a href="{$self}{$qs}{$qsep}td={$product->ID}">{$discount}</a></td>
\t\t\t\t\t<td><a href="{$self}{$qs}{$qsep}ts={$product->ID}">{$sellout}</a></td>
\t\t\t\t\t<td>{$usage}</td>
\t\t\t\t\t<td>{$photostr}</td>
\t\t\t\t\t<td>{$lastchange}</td>
\t\t\t\t\t<td><a href="{$self}{$qs}{$qsep}as={$product->ID}">{$active}</a></td>
\t\t\t\t</tr>

EOT;
            $sw = $next_sw[$sw];
        }
        if (sizeof($this->checked) == 0) {
            $disabled_str = ' disabled';
            $but_class = 'but3D';
        } else {
            $disabled_str = '';
            $but_class = 'but3';
        }
        $html .= <<<EOT
\t\t\t</table>
\t\t</div>
\t</div>
\t<div class="form2">
\t\t<fieldset>

EOT;
        if ($this->eshop_item || $this->newsletter) {
            $html .= <<<EOT
\t\t\t<input type="submit" id="kprfc_cmd5" name="cmd" value="zufügen" class="{$but_class}"{$disabled_str} />

EOT;
        } else {
            $html .= <<<EOT
\t\t\t<input type="submit" id="kprfc_cmd1" name="cmd" value="Artikel hinzufügen" class="but3" />

EOT;
        }
        $html .= <<<EOT
\t\t\t<input type="submit" id="kprfc_cmd2" name="cmd" value="entfernen" class="{$but_class}"{$disabled_str} onclick="return Kiwi_Products_Form.onDelete()" />
\t\t\t<input type="submit" id="kprfc_cmd3" name="cmd" value="aktivieren" class="{$but_class}"{$disabled_str} />
\t\t\t<input type="submit" id="kprfc_cmd4" name="cmd" value="deaktivieren" class="{$but_class}"{$disabled_str} />
\t\t</fieldset>
\t</div>
</form>

EOT;
        return $html;
    }
Exemple #26
0
function validDateTime($array)
{
    // returns true or false whether the Date/Time column follows equal and regular timesteps
    $col = array_search("Date/Time", $array[0]);
    //determine which column "date/time" is in
    if ($col === false) {
        // "Date/Time" does not exist in the array
        return false;
    }
    $valid = true;
    if (count($array) > 3) {
        // 1 header + 2 rows
        //determine if there is monthly interval
        $month = (int) substr($array[1][$col], 0, strpos($array[1][$col], "/"));
        for ($i = 2; $i < count($array) && $valid; $i++) {
            //get month
            $nextMonth = (int) substr($array[$i][$col], 0, strpos($array[$i][$col], "/"));
            if ($month % 12 + 1 != $nextMonth) {
                $valid = false;
            }
            $month = $nextMonth;
        }
        if ($valid) {
            return $valid;
        } else {
            $valid = true;
        }
        //else try the next validation technique
        //get the first date/time
        $time = parseDateTime($array[1][$col]);
        if (!$time) {
            //could not parse the date/time --> probably incorrect date/time format
            return false;
        }
        $nextTime = parseDateTime($array[2][$col]);
        $interval = $time->diff($nextTime);
        $time = $nextTime;
        for ($i = 3; $i < count($array); $i++) {
            $nextTime = parseDateTime($array[$i][$col]);
            $nextInterval = $time->diff($nextTime);
            if ((array) $interval != (array) $nextInterval) {
                print_r($time);
                print_r($nextTime);
                print_r($nextInterval);
                return false;
            }
            $time = $nextTime;
        }
    }
    return $valid;
}
Exemple #27
0
//
// An optional "timezone" GET parameter will force all ISO8601 date stings to a given timezone.
//
// Requires PHP 5.2.0 or higher.
//--------------------------------------------------------------------------------------------------
// Require our Event class and datetime utilities
require dirname(__FILE__) . '/utils.php';
// Short-circuit if the client did not give us a date range.
if (!isset($_GET['start']) || !isset($_GET['end'])) {
    die("Please provide a date range.");
}
// Parse the start/end parameters.
// These are assumed to be ISO8601 strings with no time nor timezone, like "2013-12-29".
// Since no timezone will be present, they will parsed as UTC.
$range_start = parseDateTime($_GET['start']);
$range_end = parseDateTime($_GET['end']);
// Parse the timezone parameter if it is present.
$timezone = null;
if (isset($_GET['timezone'])) {
    $timezone = new DateTimeZone($_GET['timezone']);
}
// Read and parse our events JSON file into an array of event data arrays.
$json = file_get_contents(dirname(__FILE__) . '//json/events.json');
$input_arrays = json_decode($json, true);
// Accumulate an output array of event data arrays.
$output_arrays = array();
foreach ($input_arrays as $array) {
    // Convert the input array into a useful Event object
    $event = new Event($array, $timezone);
    // If the event is in-bounds, add it to the output
    if ($event->isWithinDayRange($range_start, $range_end)) {
    public function _getHTML()
    {
        $this->loadLastChange();
        $this->loadActions();
        $self = basename($_SERVER['PHP_SELF']);
        $html = <<<EOT
<form action="{$self}?ag={$this->agid}" method="post">
\t<h2>KATALOG Aktionen - [Liste]</h2>
\t<div class="levyV">

EOT;
        if ($this->lastchange != null) {
            $html .= <<<EOT
\t\t<div class="zmena">Zuletzt Aktualisiert: {$this->lastchange->format()}</div>

EOT;
        }
        $disabled_str = sizeof($this->actions) == 0 ? ' disabled' : '';
        $all_checked_str = $this->all_checked ? ' checked' : '';
        $html .= <<<EOT
\t\t<div id="frame">
\t\t\t<table class="tab-seznam" cellspacing="0" cellpadding="0">
\t\t\t\t<tr>
\t\t\t\t\t<th><input type="checkbox" name="checkall" value="Vsechny"{$disabled_str} onclick="checkUncheckAll(document.getElementsByName('check[]'),this);Kiwi_Actions_Form.enableBtns(false);"{$all_checked_str} /></th>
\t\t\t\t\t<th>Name</th>
\t\t\t\t\t<th></th>
\t\t\t\t\t<th>geändert</th>
\t\t\t\t\t<th>aktiv</th>

EOT;
        if (!$this->read_only) {
            $html .= <<<EOT
\t\t\t\t\t<th>Priorität</th>

EOT;
        }
        $html .= <<<EOT
\t\t\t\t</tr>

EOT;
        $sw = 1;
        $next_sw = array(1 => 2, 2 => 1);
        $i = 0;
        foreach ($this->actions as $action) {
            $i++;
            $checked_str = isset($this->checked[$action->ID]) && $this->checked[$action->ID] ? ' checked' : '';
            $title = htmlspecialchars($action->Title);
            $plink = KIWI_EDIT_ACTION . "?ag={$this->agid}&a={$action->ID}";
            if ($action->Picture) {
                $photo = 'photoOK';
                $phototitle = 'Aktion hat Bild';
            } else {
                $photo = 'photoKO';
                $phototitle = 'Kein Bild vorhanden';
            }
            $photostr = <<<EOT
<img src="./image/{$photo}.gif" alt="" title="{$phototitle}" />
EOT;
            $dt = parseDateTime($action->LastChange);
            $lastchange = date('j.n.Y H:i', $dt['stamp']);
            $active = $action->Active != 0 ? 'ja' : 'nein';
            $html .= <<<EOT
\t\t\t\t<tr class="t-s-{$sw}">
\t\t\t\t\t<td><input type="checkbox" name="check[]" value="{$action->ID}" onclick="Kiwi_Actions_Form.enableBtns(this.checked)"{$checked_str} /></td>
\t\t\t\t\t<td><a href="{$plink}">{$title}</a></td>
\t\t\t\t\t<td>{$photostr}</td>
\t\t\t\t\t<td>{$lastchange}</td>

EOT;
            if (!$this->read_only) {
                $html .= <<<EOT
\t\t\t\t\t<td><a href="{$self}?ag={$this->agid}&as={$action->ID}">{$active}</a></td>

EOT;
            } else {
                $html .= <<<EOT
\t\t\t\t\t<td>{$active}</td>

EOT;
            }
            if (!$this->read_only) {
                $nullimg = "<img src=\"./image/null.gif\" alt=\"\" title=\"\" width=\"18\" height=\"18\" />";
                $html .= "\t\t\t\t\t<td>" . ($i < sizeof($this->actions) - 1 ? "<a href=\"{$self}?dd={$action->ID}\"><img src=\"./image/alldown.gif\" alt=\"\" title=\"ganz unten\" width=\"18\" height=\"18\" /></a>" : $nullimg) . ($i < sizeof($this->actions) ? "<a href=\"{$self}?d={$action->ID}\"><img src=\"./image/down.gif\" alt=\"\" title=\"unten\" width=\"18\" height=\"18\" /></a>" : $nullimg) . ($i > 1 ? "<a href=\"{$self}?u={$action->ID}\"><img src=\"./image/up.gif\" alt=\"\" title=\"oben\" width=\"18\" height=\"18\" /></a>" : $nullimg) . ($i > 2 ? "<a href=\"{$self}?uu={$action->ID}\"><img src=\"./image/allup.gif\" alt=\"\" title=\"ganz oben\" width=\"18\" height=\"18\" /></a>" : $nullimg) . "</td>\n";
            }
            $html .= <<<EOT
\t\t\t\t</tr>

EOT;
            $sw = $next_sw[$sw];
        }
        if (sizeof($this->checked) == 0) {
            $disabled_str = ' disabled';
            $but_class = 'but3D';
        } else {
            $disabled_str = '';
            $but_class = 'but3';
        }
        $html .= <<<EOT
\t\t\t</table>
\t\t</div>
\t</div>
\t<div class="form2">
\t\t<fieldset>
\t\t\t<input type="submit" id="kacfc_cmd1" name="cmd" value="Aktion hinzufügen" class="but3" />
\t\t\t<input type="submit" id="kacfc_cmd2" name="cmd" value="entfernen" class="{$but_class}"{$disabled_str} onclick="return Kiwi_Actions_Form.onDelete()" />
\t\t\t<input type="submit" id="kacfc_cmd3" name="cmd" value="aktivieren" class="{$but_class}"{$disabled_str} />
\t\t\t<input type="submit" id="kacfc_cmd4" name="cmd" value="deaktivieren" class="{$but_class}"{$disabled_str} />
\t\t</fieldset>
\t</div>
</form>

EOT;
        return $html;
    }
Exemple #29
0
function convertDurationToDelta($value, $prefix = "")
{
    $date = parseDateTime($value);
    if ($date) {
        // valid ISO Duration split into date and time
        return @$date['year'] ? "{$prefix}" . $date['year'] : @$date['month'] ? "{$prefix}" . $date['month'] : @$date['day'] ? "{$prefix}" . $date['day'] : @$date['hour'] ? "{$prefix}" . $date['hour'] : @$date['minute'] ? "{$prefix}" . $date['minute'] : @$date['second'] ? "{$prefix}" . $date['second'] : "";
    }
}
Exemple #30
0
function killStupidBank()
{
    $now = time();
    $Start = date("Y-m-d") . " " . changeMinute("16:30", "+5") . ":00";
    $End = date("Y-m-d") . " " . changeMinute("17:54", "+5") . ":00";
    $arrStart = parseDateTime($Start);
    $unixStart = mktime($arrStart[3], $arrStart[4], $arrStart[5], $arrStart[1], $arrStart[2], $arrStart[0]);
    $arrEnd = parseDateTime($End);
    $unixEnd = mktime($arrEnd[3], $arrEnd[4], $arrEnd[5], $arrEnd[1], $arrEnd[2], $arrEnd[0]);
    if ($unixStart <= $now && $now <= $unixEnd) {
        return true;
    } else {
        return false;
    }
}