コード例 #1
0
ファイル: Prices.php プロジェクト: apixon/php-namespaces
 function __construct($data = null)
 {
     if (!empty($data)) {
         parent::__construct($data);
         $this->{$datasource} = $data;
     }
 }
コード例 #2
0
 public function actionIndex()
 {
     $this->partner_id = Yii::app()->params['partner_id'];
     $file = dirname(__FILE__) . '/../../../../common/config/contacts.php';
     if (!is_file($file)) {
         throw new CHttpException(404, 'Файл контактов не найден' . $file);
     }
     $content = file_get_contents($file);
     $arr = json_decode($content, true);
     $partnerModel = Partners::model()->findByPk($this->partner_id);
     if ($partnerModel == NULL) {
         throw new CHttpException(404, 'Указанная запись не найдена');
     }
     $model = new ContactForm();
     $model->setAttributes($arr);
     if (isset($_POST['Partners']) || isset($_POST['ContactForm'])) {
         $partnerModel->attributes = $_POST['Partners'];
         $partnersuccess = $partnerModel->validate();
         if ($partnersuccess) {
             $partnerModel->update();
         }
         $config = array('vk' => $_POST['ContactForm']['vk'], 'twitter' => $_POST['ContactForm']['twitter'], 'facebook' => $_POST['ContactForm']['facebook'], 'odnokl' => $_POST['ContactForm']['odnokl']);
         $model->setAttributes($config);
         $confsuccess = $model->validate();
         if ($confsuccess) {
             $str = json_encode($config);
             file_put_contents($file, $str);
         }
         if ($partnersuccess && $confsuccess) {
             Yii::app()->user->setFlash('config', Yii::t('main', 'Your new options have been saved.'));
         }
     }
     $this->render('index', array('model' => $model, 'partnerModel' => $partnerModel));
 }
コード例 #3
0
ファイル: Hotels.php プロジェクト: apixon/php-namespaces
 public function getHotels($data)
 {
     $hotels = '';
     $Partners = new Partners();
     if (!empty($data)) {
         foreach ($data->hotels as $id => $hotel) {
             $hotels[$id]['name'] = $hotel->name;
             // get hotel name. data from db
             $hotels[$id]['address'] = $hotel->adr;
             // get hotel address. data from db
             $hotels[$id]['city'] = $data->city;
             // get hotel city. data from db
             $hotels[$id]['Partners'] = $Partners->getPartners($hotel->partners);
         }
     }
     return $hotels;
 }
コード例 #4
0
 public function destroy($id, $request)
 {
     if (Partners::exists($id)) {
         $partner = Partners::find($id);
         $partner->delete();
     }
     return new JsonResponse([]);
 }
コード例 #5
0
 /**
  * Deletes a particular model.
  * If deletion is successful, the browser will be redirected to the 'admin' page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     $model = Partners::model()->with(array('portfolio' => array('with' => 'photos')))->findByPk($id);
     $model->deletePartners();
     // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
     if (!isset($_GET['ajax'])) {
         $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('index'));
     }
 }
コード例 #6
0
ファイル: partners.php プロジェクト: iagosilvany/projeto2
         }
     } else {
         $_SESSION['msg'] = 'A inserção falhou';
         header('Location:../views/partners.php');
     }
     break;
 case 'update':
     if ($_POST["address"] != "") {
         if ($_FILES['image']['tmp_name'] != '') {
             if (is_uploaded_file($_FILES['image']['tmp_name'])) {
                 $_POST['image'] = resizer($_FILES['image']);
             }
         } else {
             $_POST['image'] = Partners::selectImage($_POST['id'], $connect);
         }
         $partners = new Partners($_POST);
         try {
             $partners->update($_POST['id'], $connect);
             $_SESSION['msg'] = "Sua edição foi realizada com sucesso!";
             header('Location:../views/partners.php');
         } catch (PDOException $e) {
             $_SESSION['msg'] = "Sua edição falhou!";
             header('Location:../views/partners.php');
         }
     }
     break;
 case 'delete':
     if (isset($_POST['id'])) {
         if (Partners::delete($_POST['id'], $connect)) {
             $_SESSION['msg'] = "Parceiro deletado.";
             header('Location:../views/partners.php');
コード例 #7
0
ファイル: main.php プロジェクト: boulama/DreamVids
    ?>
</a>
<?php 
}
?>
					</div>

					<div class="row">

						<h1><?php 
echo Translator::get("footer.partners");
?>
</h1>
						
						<?php 
$partners = Partners::all();
foreach ($partners as $part) {
    echo '<a href="' . $part->url . '" target="_blank">' . $part->name . '</a>';
}
?>
						<a href="javascript:void(0)" onclick="alert('<?php 
echo Translator::get("footer.become_partner.popup");
?>
')"><?php 
echo Translator::get("footer.become_partner.title");
?>
</a>

					</div>

					<div class="row">
コード例 #8
0
ファイル: partners.php プロジェクト: TheTypoMaster/evans
    // Arguments for the CPT loop
    protected $loop_args = array('orderby' => 'menu_order', 'order' => 'ASC', 'quantity' => 500);
    public function display_loop($pid)
    {
        $html = "";
        $link = get_post_meta($pid, otm_cmb_prefix($this->cptslug) . 'url', true);
        $img_id = get_post_meta($pid, otm_cmb_prefix($this->cptslug) . 'image_id', true);
        $img = wp_get_attachment_image_src($img_id, $this->cptslug . '-thumb');
        $html .= "<li class='" . $this->cptslug . "'>";
        if (!empty($link)) {
            $html .= "<a class='group' href='" . esc_url($link) . "'>";
        }
        if (!empty($img[0])) {
            $html .= "<img src='{$img['0']}' alt='" . get_the_title() . "'>";
        }
        if (!empty($link)) {
            $html .= "</a>";
        }
        $html .= "</li>";
        return $html;
    }
    public function cmb_metaboxes(array $meta_boxes)
    {
        // Start with an underscore to hide fields from custom fields list
        $prefix = otm_cmb_prefix($this->cptslug);
        $meta_boxes[] = array('id' => $this->cptslug . '_metabox', 'title' => sprintf(__('%s Information', 'evans-mu'), $this->singular), 'object_types' => array($this->cptslug), 'context' => 'normal', 'priority' => 'high', 'show_names' => true, 'fields' => array(array('name' => __('Link URL', 'evans-mu'), 'desc' => __('Enter the URL from the page you want to link to.', 'evans-mu'), 'id' => $prefix . 'url', 'type' => 'text'), array('name' => __('Image', 'evans-mu'), 'id' => $prefix . 'image', 'type' => 'file', 'allow' => array('attachment'))));
        return $meta_boxes;
    }
}
$partners = new Partners();
$partners->hooks();
コード例 #9
0
ファイル: partners.php プロジェクト: iagosilvany/projeto2
">
					<input name="id" type="hidden" value="<?php 
    echo $one['id'];
    ?>
">
					<button name="action" value="update">EDITAR</button>	
					<?php 
}
?>
			</form>	
		</div>
			<div class="content-table">		
				<h2>Parceiros adicionados</h2>
				<table>
					<?php 
$partners = Partners::selectAll($connect);
?>
					<thead>
						<tr>
							<td><h2>ID</h2></td>
							<td><h2>Imagem</h2></td>
							<td><h2>Link</h2></td>
						</tr>
					</thead>
					<tbody>
						<?php 
foreach ($partners as $partner) {
    ?>
						<tr>
						<td><h3><a href="partners.php?id=<?php 
    echo $partner['id'];
コード例 #10
0
ファイル: auth.php プロジェクト: alex-k/velotur
<?php

$partner = $_SESSION['partner'];
if (!is_object($partner) || !$partner->exists()) {
    if (!empty($_POST['formLoginSubmit'])) {
        $smarty->assign($_POST);
        $out = $smarty->fetch('login.html');
        if (!empty($_POST) && !empty($_POST[formLoginSubmit]) && ($smarty->_validate_processed == 1 && $smarty->_validate_error != 1)) {
            $partner = new Partners();
            if ($partner->auth($_POST['partnerLogin'], $_POST['partnerPassword'])) {
                $message = '_partnerAuthOK';
                $_SESSION['partner'] = $partner;
            } else {
                $message = '_errorLogPass';
            }
        }
    }
}
if ($partner && $partner->exists()) {
    $partner = new Partners($partner->getID());
    $partner->loadLinkedFromDB();
    $smarty->assign('Partner', $partner->getValues());
} else {
    $smarty->display('login.html');
    exit;
}
コード例 #11
0
ファイル: catalog.php プロジェクト: gabzon/experiensa
 public static function get_catalog()
 {
     $code = Helpers::getActiveLanguageCode();
     if (!$code) {
         $lang_req = "";
     } else {
         $lang_req = '?lang=' . $code;
     }
     $api_response = [];
     //Agency Catalog
     $agency_api_url = get_site_url() . '/wp-json/wp/v2/voyage';
     //        echo " el agency api url es ".$agency_api_url;
     if (function_exists('curl_version')) {
         //Using Curl
         //  Initiate curl
         $ch = curl_init();
         // Disable SSL verification
         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
         // Will return the response, if false it print the response
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         // Set the url
         $real_url = $agency_api_url . $lang_req;
         //            echo "el real url propio es ".$real_url;
         curl_setopt($ch, CURLOPT_URL, $real_url);
         // Execute
         $agency_response = curl_exec($ch);
         if (!$agency_response) {
             curl_setopt($ch, CURLOPT_URL, $agency_api_url);
             $agency_response = curl_exec($ch);
         }
         // Closing
         curl_close($ch);
     } else {
         if (ini_get('allow_url_fopen')) {
             $agency_response = @file_get_contents($agency_api_url . $lang_req);
             if (!$agency_response) {
                 $agency_response = @file_get_contents($agency_api_url);
             }
         } else {
             $agency_response = "";
         }
     }
     //        echo "<pre>";
     //        print_r($agency_response);
     //        echo "</pre>";
     $agency_response = json_decode($agency_response);
     $api_response[] = $agency_response;
     //Partners Catalog
     $partners = Partners::partnerApiList();
     if (!empty($partners) && Helpers::check_internet_connection()) {
         for ($i = 0; $i < count($partners); $i++) {
             // Check if  $partners[$i]['website'] dont have '/' on last char
             $api_url = $partners[$i]['website'];
             if (substr($partners[$i]['website'], -1) != '/') {
                 $api_url .= '/';
             }
             $api_url .= 'wp-json/wp/v2/voyage';
             //                echo "<br>entro a un partner ".$api_url;
             //Check if $api_url is a valid url
             if (!(filter_var($api_url, FILTER_VALIDATE_URL) === FALSE)) {
                 //                    echo "<br>entro aqui ".$api_url;
                 $file_headers = @get_headers($api_url);
                 //                    echo "<br>los header de ".$api_url;
                 //                    echo "<pre>";
                 //                    print_r($file_headers);
                 //                    echo "</pre>";
                 //check if url have response HTTP/1.1 200 OK
                 if (!empty($file_headers) && strpos($file_headers[0], 'OK') !== FALSE) {
                     //Using Curl
                     if (function_exists('curl_version')) {
                         //  Initiate curl
                         $ch = curl_init();
                         // Disable SSL verification
                         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
                         // Will return the response, if false it print the response
                         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                         // Set the url
                         $real_url = $api_url . $lang_req;
                         //                            echo "<br> real url ".$real_url;
                         curl_setopt($ch, CURLOPT_URL, $real_url);
                         // Execute
                         $partner_response = curl_exec($ch);
                         if (!$partner_response) {
                             //                                echo "<br> api url ".$api_url;
                             curl_setopt($ch, CURLOPT_URL, $api_url);
                             $partner_response = curl_exec($ch);
                         }
                         // Closing
                         curl_close($ch);
                     } else {
                         if (ini_get('allow_url_fopen')) {
                             $partner_response = @file_get_contents($api_url . $lang_req);
                             if (!$partner_response) {
                                 $partner_response = @file_get_contents($api_url);
                             }
                         } else {
                             $partner_response = "";
                         }
                     }
                     $partner_response = json_decode($partner_response);
                     $api_response[] = $partner_response;
                 }
             }
         }
     }
     //        echo "<pre>";
     //        print_r($api_response);
     //        echo "</pre>";
     $voyages = array();
     for ($i = 0; $i < count($api_response); $i++) {
         for ($j = 0; isset($api_response[$i]) && $j < count($api_response[$i]); $j++) {
             $voyage = $api_response[$i][$j];
             $tab = ['id' => $voyage->id, 'title' => $voyage->title->rendered, 'excerpt' => $voyage->excerpt->rendered, 'cover_image' => $voyage->cover_image, 'currency' => $voyage->currency, 'price' => $voyage->price, 'itinerary' => $voyage->itinerary, 'duration' => $voyage->duration, 'country' => isset($voyage->country) ? $voyage->country : "", 'location' => isset($voyage->location) ? $voyage->location : "", 'theme' => isset($voyage->theme) ? $voyage->theme : "", 'api_link' => $voyage->link, 'website' => $voyage->website, 'website_name' => $voyage->website_name];
             $voyages[] = $tab;
         }
     }
     return $voyages;
     // Restore original Post Data
     wp_reset_postdata();
 }
コード例 #12
0
ファイル: partner_edit.php プロジェクト: alex-k/velotur
<?php

require_once "../../config/init.php";
require_once "auth.php";
loadclass("Partners");
$partnero = new Partners((int) $_POST['_id']);
$smarty->assign($partnero->getValues());
$smarty->assign($_POST);
$output = $smarty->fetch("partner_edit.html");
if (!empty($_POST) && !empty($_POST[formSubmit]) && ($smarty->_validate_processed == 1 && $smarty->_validate_error != 1)) {
    include "_default.action.php";
    exit;
}
$smarty->display("partner_edit.html");
コード例 #13
0
ファイル: partners.php プロジェクト: alex-k/velotur
<?php

require_once "../../config/init.php";
require_once "auth.php";
$guideo = new Partners();
$smarty->assign('Partners', $guideo->searchFromDB());
$smarty->display("partners.html");
コード例 #14
0
 public function loadModel($id)
 {
     $model = Partners::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }