Example #1
0
    case 2:
        $model = new Layout_Model();
        if (!empty($_POST)) {
            if ($model->deleteGallery($_POST['pictureId'])) {
                echo 1;
            }
        }
        break;
    case 3:
        $model = new Layout_Model();
        $allowedExtensions = array("jpg", "JPG", "jpeg", "png");
        $sizeLimit = 20 * 1024 * 1024;
        $uploader = new Media_Model($allowedExtensions, $sizeLimit);
        $savePath = $root . '/images/media/original/';
        $medium = $root . '/images/media/thumb/';
        $pre = 'Villa-Aqua-' . Tools::slugify($_POST['sectionName']);
        $mediumWidth = 550;
        if ($result = $uploader->handleUpload($savePath, $pre)) {
            $uploader->getThumb($result['fileName'], $savePath, $medium, $mediumWidth, 'width', '');
            $newData = getimagesize($medium . $result['fileName']);
            $wp = $newData[0];
            $hp = $newData[1];
            $lastId = 0;
            if ($newData) {
                $lastId = $model->addGallery($_POST['sectionName'], $result['fileName']);
            }
            $data = array('success' => true, 'fileName' => $result['fileName'], 'wp' => $wp, 'hp' => $hp, 'lastId' => $lastId);
            echo htmlspecialchars(json_encode($data), ENT_NOQUOTES);
        }
        break;
}
<?php

$root = $_SERVER['DOCUMENT_ROOT'];
require_once $root . '/views/front/Layout_View.php';
if ($_POST['submit']) {
    $term = $_POST['term'];
    if ($term) {
        $term = Tools::slugify($term);
        switch ($_POST['type']) {
            case 0:
                header('Location: search/in-all/site/' . $term . '/0');
                break;
        }
    }
}
    public function getEditCompanyMediaBox()
    {
        ob_start();
        ?>
		<div class="content-box">
			<?php 
        echo self::getEditCompanyTop();
        ?>
			<div>
				<input type="hidden" id="companyId" value="<?php 
        echo $this->data['company']['general']['company_id'];
        ?>
" />
				<input type="hidden" id="logoId" value="<?php 
        echo $this->data['company']['logo']['logo_id'];
        ?>
" />
				<input type="hidden" id="companyNameClean" value="<?php 
        echo Tools::slugify($this->data['company']['general']['name']);
        ?>
" />
				
				<div class="mediaSections" >
					<h1>Logo</h1>
					<p>(300px / 150px)</p>
					
					<div class="">
						<div class="logo-uploader">
							Upload
						</div>
						<div class="logo-box">
							<div style="width: 300px; height:150px" class="crop-container-logo"> <img src="/img-up/companies_pictures/logo/<?php 
        echo $this->data['company']['logo']['logo'];
        ?>
" id="cropLogo" /></div>
						</div>
						<a href="#" class="button save-crop" id="save-crop-logo">save</a>
						<div class="clr"></div>
					</div>
				</div>
				
				<div class="mediaSections" >
					<h1>Sliders</h1>
					<p>(640px / 255px)</p>
					
					<div class="slider-box">
						<div class="company-slider-uploader">
								Upload
						</div>
						<div class="company-slider-upload">
							<div class="crop-box">
								<div style="width: 640px; height:255px" class="crop-container"> <img src="" id="crop-company-slider" /></div>
							</div>
							<a href="#" class="button save-crop" id="save-crop-company-slider">save</a>
							<div class="clr"></div>
						</div>
						<div id="slider-items">
							<?php 
        foreach ($this->data['company']['sliders'] as $slider) {
            ?>
							<div class="slider-item" id="sid-<?php 
            echo $slider['sliders_id'];
            ?>
">
								<header>
									<a href="#" class="button red delete-slider" sid="<?php 
            echo $slider['sliders_id'];
            ?>
">delete</a>
								</header>
								<section>
									<div class="img-container">
					    				<img src="/img-up/companies_pictures/sliders/<?php 
            echo $slider['slider'];
            ?>
"  />
					    			</div>
								</section>
								<div class="clr"></div>
							</div>
							<?php 
        }
        ?>
						</div>
					</div>
				</div>
				
				<div class="mediaSections" >
					<h1>Gallery</h1>
					
					<div class="company-gallery-uploader">
						Upload
					</div>
					
					<div class="company-gallery-grid">
						<?php 
        if ($this->data['company']['gallery']) {
            foreach ($this->data['company']['gallery'] as $g) {
                ?>
							<div class="image-box" id="cgid-<?php 
                echo $g['picture_id'];
                ?>
">
								<div class="image">		
									<img src="/img-up/companies_pictures/galery/<?php 
                echo $g['picture'];
                ?>
" />
								</div>
								<a href="javascript:void(0);" cgid="<?php 
                echo $g['picture_id'];
                ?>
" class="deleteGallery" >delete</a>
							</div>
							<?php 
            }
        }
        ?>
						<div class="clr"></div>
					</div>
				</div>
				
	   			<div class="clr"></div>
			</div>
		</div>
		<?php 
        $editContent = ob_get_contents();
        ob_get_clean();
        return $editContent;
    }
    /**
     * items for the search result
     * @param unknown $r
     * @param unknown $term
     * @return string
     */
    public function getResItem($r, $term)
    {
        ob_start();
        $description = strip_tags($r['description']);
        $title = $r['name'];
        $size = strlen($description);
        $pos = stripos($description, $term);
        $show = '';
        $sizeTerm = strlen($term);
        if ($pos > -1) {
            $preEnd = $pos + $sizeTerm;
            $beforeTerm = substr($description, 0, $pos - 1);
            $indexSpaces = explode(' ', $beforeTerm);
            $lastWord = end($indexSpaces);
            $longLastWord = strlen($lastWord);
            $start = $pos - $longLastWord;
            $lastLong = 150 - $sizeTerm - $longLastWord;
            $end = $preEnd + $lastLong;
            $show = substr($description, $start - 1, $lastLong);
            $realTerm = substr($description, $pos, $sizeTerm);
            $show = str_replace($realTerm, '<strong>' . $realTerm . '</strong>', $show);
        } else {
            $show = substr($description, 0, 150);
        }
        $posTitle = stripos($title, $term);
        if ($posTitle > -1) {
            $realTermTitle = substr($title, $posTitle, $sizeTerm);
            $title = str_replace($realTermTitle, '<strong>' . $realTermTitle . '</strong>', $title);
        }
        $link = "/company/" . $r['category'] . "/" . Tools::slugify($r['category_name']) . "/" . $r['company_id'] . "/" . Tools::slugify($r['name']) . "/";
        ?>
		<li>
			<article class='protip'>
				<header>
					<div class="img-cover">	
					<?php 
        if ($r['logo']) {
            ?>
						<a href="<?php 
            echo $link;
            ?>
" class="title hyphenate track x-mode-popup" data-action="view protip" data-from="mini protip">
							<img src="/img-up/companies_pictures/logo/<?php 
            echo $r['logo'];
            ?>
" 
								alt="<?php 
            echo $r['name'];
            ?>
" class="protip_li_img"/>
						</a>
					<?php 
        } else {
            ?>
						<a href="<?php 
            echo $link;
            ?>
" class="title hyphenate track x-mode-popup" data-action="view protip" data-from="mini protip">
							<img src="/images/default_item_front.jpg" 
								alt="<?php 
            echo $r['name'];
            ?>
"  class="protip_li_img"/>
						</a>
					<?php 
        }
        ?>
					</div>
				</header>
				<a href="<?php 
        echo $link;
        ?>
"  class="title hyphenate track x-mode-popup" data-action="view protip" data-from="mini protip" >
					<?php 
        echo $title;
        ?>
				</a>
				<footer class='cf search-tile'>
						<?php 
        echo $show . ' ...';
        ?>
				</footer>
			</article>
		</li>
		
		<?php 
        $item = ob_get_contents();
        ob_end_clean();
        return $item;
    }
    public static function listAgencies($agencies)
    {
        ob_start();
        if ($agencies) {
            foreach ($agencies as $agency) {
                ?>
				<tr>
					<td>
	   					<?php 
                echo $agency['agency'];
                ?>
	   				</td>
					<td>
	   					<a href="/<?php 
                echo $member['member_id'];
                ?>
/<?php 
                echo Tools::slugify($member['name'] . ' ' . $member['last_name']);
                ?>
/">
	   						<i class="glyphicon glyphicon-remove"></i>
	   					</a>
	   				</td>
   				</tr>
				<?php 
            }
        }
        $agencies = ob_get_contents();
        ob_end_clean();
        return $agencies;
    }
$root = $_SERVER['DOCUMENT_ROOT'];
require_once $root . '/models/back/Media_Model.php';
require_once $root . '/models/back/Layout_Model.php';
require_once $root . '/backends/admin-backend.php';
require_once $root . '/Framework/Tools.php';
switch ($_GET['option']) {
    // 	Upload
    case 1:
        $model = new Layout_Model();
        $data = $backend->loadBackend();
        $allowedExtensions = array("jpg", "JPG", "jpeg", "png");
        $sizeLimit = 20 * 1024 * 1024;
        $uploader = new Media_Model($allowedExtensions, $sizeLimit);
        $savePath = $root . '/img-up/companies_pictures/original/';
        $medium = $root . '/img-up/companies_pictures/logo-medium/';
        $pre = 'logo-' . Tools::slugify($_POST['companyName']);
        $mediumWidth = 300;
        if ($result = $uploader->handleUpload($savePath, $pre)) {
            $uploader->getThumb($result['fileName'], $savePath, $medium, $mediumWidth, 'width', '');
            $newData = getimagesize($medium . $result['fileName']);
            $wp = $newData[0];
            $hp = $newData[1];
            $lastId = 0;
            if ($newData) {
                if ($_POST['lastIdLogo'] > 0) {
                    if ($model->updateCompanyLogo($_POST['lastIdLogo'], $result['fileName'])) {
                        $lastId = $_POST['lastIdLogo'];
                    }
                } else {
                    $lastId = $model->addCompanyLogo($_POST['companyId'], $result['fileName']);
                }
Example #7
0
$root = $_SERVER['DOCUMENT_ROOT'];
require_once $root . '/models/back/Media_Model.php';
require_once $root . '/models/back/Layout_Model.php';
require_once $root . '/backends/admin-backend.php';
require_once $root . '/Framework/Tools.php';
switch ($_GET['option']) {
    // 	Upload
    case 1:
        $model = new Layout_Model();
        $data = $backend->loadBackend();
        $allowedExtensions = array("jpg", "JPG", "jpeg", "png");
        $sizeLimit = 20 * 1024 * 1024;
        $uploader = new Media_Model($allowedExtensions, $sizeLimit);
        $savePath = $root . '/img-up/main-gallery/original/';
        $medium = $root . '/img-up/main-gallery/medium/';
        $pre = Tools::slugify($data['appInfo']['siteName']);
        $mediumWidth = 880;
        if ($result = $uploader->handleUpload($savePath, $pre)) {
            $uploader->getThumb($result['fileName'], $savePath, $medium, $mediumWidth, 'width', '');
            $newData = getimagesize($medium . $result['fileName']);
            $wp = $newData[0];
            $hp = $newData[1];
            $lastId = 0;
            if ($newData) {
                $lastId = $model->addSlider($result['fileName']);
            }
            $data = array('success' => true, 'fileName' => $result['fileName'], 'wp' => $wp, 'hp' => $hp, 'lastId' => $lastId);
            echo htmlspecialchars(json_encode($data), ENT_NOQUOTES);
        }
        break;
        // 	Crop
$root = $_SERVER['DOCUMENT_ROOT'];
require_once $root . '/models/back/Media_Model.php';
require_once $root . '/models/back/Layout_Model.php';
require_once $root . '/backends/admin-backend.php';
require_once $root . '/Framework/Tools.php';
switch ($_GET['option']) {
    // 	Upload
    case 1:
        $model = new Layout_Model();
        $data = $backend->loadBackend();
        $allowedExtensions = array("jpg", "JPG", "jpeg", "png");
        $sizeLimit = 20 * 1024 * 1024;
        $uploader = new Media_Model($allowedExtensions, $sizeLimit);
        $savePath = $root . '/img-up/companies_pictures/original/';
        $medium = $root . '/img-up/companies_pictures/galery/';
        $pre = 'gallery-' . Tools::slugify($_POST['companyName']);
        $mediumWidth = 200;
        if ($result = $uploader->handleUpload($savePath, $pre)) {
            $uploader->getThumb($result['fileName'], $savePath, $medium, $mediumWidth, 'width', '');
            $newData = getimagesize($medium . $result['fileName']);
            $wp = $newData[0];
            $hp = $newData[1];
            $lastId = 0;
            if ($newData) {
                $lastId = $model->addCompanyGallery($_POST['companyId'], $result['fileName']);
            }
            $data = array('success' => true, 'fileName' => $result['fileName'], 'wp' => $wp, 'hp' => $hp, 'lastId' => $lastId);
            echo htmlspecialchars(json_encode($data), ENT_NOQUOTES);
        }
        break;
        // 	Delete
    /**
     * Display the tasks
     * 
     * @param array $tasks all the tasks
     * @return string
     */
    public static function listTasks($tasks)
    {
        ob_start();
        if ($tasks) {
            foreach ($tasks as $task) {
                $date = Tools::formatMYSQLToFront($task['date']);
                $time = Tools::formatHourMYSQLToFront($task['time']);
                ?>
				<li
   				<?php 
                if ($task['status'] == 1) {
                    echo 'class="completed"';
                }
                if (strtotime($date) == strtotime(@date('d-M-Y', strtotime('now')))) {
                    echo 'class="today"';
                }
                if (strtotime($date) < strtotime('now')) {
                    echo 'class="pending"';
                }
                if (strtotime($date) > strtotime('now')) {
                    echo 'class="future"';
                }
                ?>
   				>
   					<div class="header">
   						<div class="info">
   							<strong><?php 
                echo $task['assigned_to'];
                ?>
 </strong>
   							<span class="text-primary"><?php 
                echo $date . ' ' . $time;
                ?>
</span>
   							<span class="text-muted"><?php 
                echo $task['assigned_by'];
                ?>
</span>
   						</div>
   						<?php 
                if ($task['status'] == 0) {
                    ?>
	                    	<a href="javascript: void(0);" class="completeTask" tid="<?php 
                    echo $task['task_id'];
                    ?>
"><i class="glyphicon glyphicon-check icon" ></i></a>
	                    <?php 
                }
                if ($task['member_id']) {
                    ?>
   						<div class="member">
   							<a href="/<?php 
                    echo $task['member_id'];
                    ?>
/<?php 
                    echo Tools::slugify($task['name'] . ' ' . $task['last_name']);
                    ?>
/">
   								<?php 
                    echo $task['name'] . ' ' . $task['last_name'];
                    ?>
   							</a>
   						</div>
   						<?php 
                }
                ?>
   						<div class="clear"></div>
   					</div>
   					<div class="clear"></div>
   					<div>
   						<i class="glyphicon glyphicon-option-vertical"></i>
   						<div class="history-title">
   							<span class="task-title-sp"><?php 
                echo $task['content'];
                ?>
</span>
   						</div>
   					</div>
   					<div class="clear"></div>
   				</li>
   				<?php 
            }
        }
        $tasks = ob_get_contents();
        ob_end_clean();
        return $tasks;
    }
$root = $_SERVER['DOCUMENT_ROOT'];
require_once $root . '/models/back/Media_Model.php';
require_once $root . '/models/back/Layout_Model.php';
require_once $root . '/backends/admin-backend.php';
require_once $root . '/Framework/Tools.php';
switch ($_GET['option']) {
    // 	Upload
    case 1:
        $model = new Layout_Model();
        $data = $backend->loadBackend();
        $allowedExtensions = array("jpg", "JPG", "jpeg", "png");
        $sizeLimit = 20 * 1024 * 1024;
        $uploader = new Media_Model($allowedExtensions, $sizeLimit);
        $savePath = $root . '/img-up/companies_pictures/original/';
        $medium = $root . '/img-up/companies_pictures/sliders-medium/';
        $pre = Tools::slugify($_POST['companyName']);
        $mediumWidth = 640;
        if ($result = $uploader->handleUpload($savePath, $pre)) {
            $uploader->getThumb($result['fileName'], $savePath, $medium, $mediumWidth, 'width', '');
            $newData = getimagesize($medium . $result['fileName']);
            $wp = $newData[0];
            $hp = $newData[1];
            $lastId = 0;
            if ($newData) {
                $lastId = $model->addCompanySlider($_POST['companyId'], $result['fileName']);
            }
            $data = array('success' => true, 'fileName' => $result['fileName'], 'wp' => $wp, 'hp' => $hp, 'lastId' => $lastId);
            echo htmlspecialchars(json_encode($data), ENT_NOQUOTES);
        }
        break;
        // 	Crop