public function up()
 {
     $this->addColumn($this->tableName, $this->columnName, 'int');
     /** @var $data Office[] */
     $data = Office::model()->findAll();
     $migratedAddresses = [];
     foreach ($data as $office) {
         $fullAddress = implode(' ', [$office->address1, $office->address2, $office->address3, $office->address4]);
         if (isset($migratedAddresses[$fullAddress])) {
             $office->addressId = $migratedAddresses[$fullAddress]->id;
             $office->save(false);
             continue;
         }
         $parts = explode(' ', $office->address1);
         $buildingNumber = array_shift($parts);
         $line2 = implode(' ', $parts);
         $address = new Address();
         $address->line1 = $buildingNumber;
         $address->line2 = $line2;
         $address->line5 = $office->address3;
         $address->postcode = $office->postcode;
         $address->save();
         $migratedAddresses[$fullAddress] = $address;
         $office->addressId = $migratedAddresses[$fullAddress]->id;
         $office->save(false);
         continue;
     }
 }
 private function fixManagement(Office $model)
 {
     $cam = Office::model()->findByAttributes(array('code' => 'CAM'));
     $model->email = '*****@*****.**';
     $model->address = $cam->address;
     $model->addressId = $cam->addressId;
 }
    static function signature($type = self::TYPE_HTML)
    {
        $officeData = Office::model()->active()->findAll();
        if ($type == self::TYPE_HTML) {
            $emailMediaImageUrl = "http://" . Yii::app()->params['hostname'] . "/images/email/";
            $emailMediaLinks = '
					<div>
					<a href="https://www.woosterstock.co.uk/"><img src="' . $emailMediaImageUrl . 'Wooster-Logo-Orange.png" alt="Wooster&Stock"/></a>&nbsp;
					<a href="https://www.facebook.com/woosterstock"><img src="' . $emailMediaImageUrl . 'facebook_square_black.png" alt=""></a>&nbsp;
					<a href="https://twitter.com/woosterstock"><img src="' . $emailMediaImageUrl . 'ttwitter_square_black.png" alt=""></a>&nbsp;
					<a href="http://vimeo.com/user13981519""><img src="' . $emailMediaImageUrl . 'vimeo_square_black.png" alt=""></a>
					</div>
				';
            $officeFooter = '<table class="valuation-email-footer" style="width: 600px; font-size: 12px; color: #555; font-family:Arial, Helvetica, sans-serif; "><tr>';
            foreach ($officeData as $value) {
                $officeFooter .= '<td style="vertical-align:top">
							<div>' . $value->shortTitle . '</div>
							<div><a href = "mailto:' . $value->email . '"> ' . $value->email . '</a></div>
							<div>Phone: ' . $value->phone . '</div>
							</td> ';
            }
            $officeFooter .= '</tr></table> ';
            return '<div style = "font-family:Arial, Helvetica, sans-serif; font-size:15px; font-weight: bold; color:#FF9900">' . $emailMediaLinks . '</div>
					' . $officeFooter;
        } else {
            $officeFooter = '';
            foreach ($officeData as $value) {
                $officeFooter .= "\n\t\t\t\t\t\t\t{$value->shortTitle}\n\n\t\t\t\t\t\t\t" . ($value->address ? $value->address->getFullAddressString() . "\n" : "") . "Phone: {$value->phone}\n\n";
            }
            return 'Wooster & Stock
					woosterstock.co.uk

					' . $officeFooter;
        }
    }
Beispiel #4
0
 public function run()
 {
     /** @var Office[] $o */
     $o = Office::model()->active()->findAll();
     $offices = [];
     foreach ($o as $office) {
         $offices[explode('@', $office->email)[0]] = $office->shortTitle;
     }
     /** @var  $detector \Device */
     $isMobile = Yii::app()->device->isDevice('mobile') ? true : false;
     $this->render($this->view ? $this->view : 'default', array('model' => $this->model, 'offices' => $offices, 'isMobile' => $isMobile));
 }
			<div class="full-width-input-wrapper">
				<?php 
$fullAddressString = isset($_GET['Property']['fullAddressString']) ? $_GET['Property']['fullAddressString'] : '';
echo CHtml::textField('Property[fullAddressString]', $fullAddressString, ['class' => 'search input-large', 'placeholder' => 'Address']);
?>
			</div>
		</div>

		<div class="row">
			<div class="half-cell">
				<label class="block-label">Branch</label>

				<div class="input-wrapper">
					<?php 
$branch = isset($deal['dea_branch']) ? $deal['dea_branch'] : null;
echo CHtml::dropDownList('Deal[dea_branch]', $branch, CHtml::listData(Office::model()->getShortBranchList($type), 'bra_id', 'shortTitle'), ['empty' => 'All']);
?>
				</div>
			</div>
			<div class="half-cell">
				<label class="block-label">Type of Property</label>

				<div class="input-wrapper">
					<?php 
$propertyType = isset($deal['dea_ptype']) ? $deal['dea_ptype'] : "";
echo CHtml::dropDownList('Deal[dea_ptype]', $propertyType, CHtml::listData(PropertyType::model()->getPublicSiteTypes($type), 'pty_id', 'pty_title'), ['empty' => 'All']);
?>
				</div>
			</div>
		</div>
Beispiel #6
0
 public function loadModel($id)
 {
     $model = Office::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'Запись не найдена.');
     }
     return $model;
 }
 public function actionUpdate($id)
 {
     $model = Office::model()->findByPk($id);
     $this->edit($model);
 }
Beispiel #8
0
<?php

if (Yii::app()->params['office'] == null) {
    $oid = Yii::app()->request->getQuery('oid');
    if ($oid > 0) {
        $profile = Office::model()->findByPk($oid);
        Yii::app()->params['office'] = $profile;
    }
} else {
    $profile = Yii::app()->params['office'];
}
if ($profile) {
    $pos = explode(' ', $profile->bgposition);
    $pos = count($pos) == 2 ? $pos : array(0, 0);
    $cart = Yii::app()->user->getState('cart');
    ?>
<div class="avatarAndMenu">
    <div class="userName">
            <div class="cartStat">
                <?php 
    if (empty($cart)) {
        ?>
                <a href="#">Корзина пуста</a>
                <?php 
    } else {
        ?>
                <a href="#">В корзине <?php 
        echo array_sum($cart);
        ?>
 товаров</a>
                <?php 
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id, $oid)
 {
     $model = Office::model()->find('user_id=:uid AND id=:oid', array(':uid' => $id, ':oid' => $oid));
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
<?php

/**
 * @var $this  InstructionController
 * @var $model Deal
 * @var $form  AdminFilterForm
 * @var $title String
 */
$types = PropertyType::model()->getTypes();
$subtypes = array();
foreach ($types as $key => $value) {
    $subtypes[$value->pty_id] = PropertyType::model()->getTypes($value->pty_id);
}
$offices = Office::model()->enabledClientMatching()->findAll();
$matchingPostcodes = [];
foreach ($offices as $value) {
    $matchingPostcodes[$value->id] = LinkOfficeToPostcode::model()->getPostcodeList($value->id);
}
$form = $this->beginWidget('AdminFilterForm', array('action' => Yii::app()->getBaseUrl() . '/' . Yii::app()->request->getPathInfo(), 'id' => 'instruction-filter-form', 'enableAjaxValidation' => false, 'model' => [$model], 'ajaxFilterGrid' => 'instruction-list', 'storeInSession' => false, 'focus' => [$model, 'searchString']));
?>
<fieldset>
	<div class="block-header">Preference</div>
	<div class="control-group">
		<label class="control-label"></label>

		<div class="controls">
			<?php 
echo $title;
?>
			<br>
			<span class="hint">Client will receive email alert for following properties</span>
Beispiel #11
0
 public function isMyOffice()
 {
     return Office::model()->find(array('select' => 'COUNT(0)', 'condition' => 'id=:oid AND user_id=:uid', 'params' => array('uid' => Yii::app()->user->id, 'oid' => $this->office_id))) !== null;
 }
Beispiel #12
0
        </div>
	<div class="field">
		<?php 
echo $form->labelEx($model, 'office_id');
?>
                <?php 
if (!$model->isNewRecord) {
    ?>
                    <?php 
    echo $form->hiddenField($model, 'id');
    ?>
                <?php 
}
?>
		<?php 
echo $form->textField($model, 'office_id', array('size' => 10, 'maxlength' => 10, 'fcselect' => 'width:"425px",data:"/office/names",value:"' . ($model->office_id > 0 ? addslashes(Office::model()->findByPk($model->office_id)->name) : '') . '"'));
?>
		<?php 
echo $form->error($model, 'office_id');
?>
	</div>

	<div class="field">
		<?php 
echo $form->labelEx($model, 'title');
?>
		<?php 
echo $form->textField($model, 'title', array('size' => 60, 'maxlength' => 255));
?>
		<?php 
echo $form->error($model, 'title');
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Office::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 /**
  * @param $id
  * @throws CHttpException
  */
 public function actionPdf($id)
 {
     Yii::import('application.extensions.less.*');
     $lessc = new lessc();
     $lessc->checkedCompile(Yii::getPathOfAlias('webroot.less') . '/' . 'html2pdf.less', Yii::getPathOfAlias('webroot.css') . '/' . 'html2pdf.css');
     $model = $this->loadModel($id);
     if (!$model) {
         throw new CHttpException(404, 'Property not found');
     }
     $settings = InstructionToPdfSettings::model()->findByAttributes(['instructionId' => $id]);
     if (!$settings) {
         $settings = new InstructionToPdfSettings();
     }
     $pdf = new WKPDF();
     $pdf->setMargins(['top' => '40']);
     $pdf->addResource('css', Yii::getPathOfAlias('webroot.css') . '/' . 'html2pdf.css');
     $cssFiles = ['html2pdf.css'];
     /** @var $browser Browser */
     $browser = Yii::app()->browser;
     if ($browser->getBrowser() == Browser::BROWSER_FIREFOX && $browser->getVersion() >= 19) {
         $pdf->addResource('css', Yii::getPathOfAlias('webroot.css') . '/' . 'helvetica_html2pdf.css');
         $cssFiles[] = 'helvetica_html2pdf.css';
     }
     $pdf->set_html($this->renderPartial('instructionToPDF', ['model' => $model, 'settings' => $settings, 'pdf' => $pdf, 'cssFiles' => $cssFiles], true));
     $pdf->set_htmlHeader($this->renderPartial('instructionToPDF/header', ['model' => $model, 'settings' => $settings, 'pdf' => $pdf, 'cssFiles' => $cssFiles], true));
     $pdf->set_htmlFooter($this->renderPartial('instructionToPDF/footer', ['model' => $model, 'settings' => $settings, 'pdf' => $pdf, 'cssFiles' => $cssFiles, 'offices' => Office::model()->active()->findAll()], true));
     $pdf->set_orientation(WKPDF::$PDF_PORTRAIT);
     $pdf->render();
     $pdf->output(WKPDF::$PDF_EMBEDDED, null);
 }
Beispiel #15
0
 protected function beforeValidate()
 {
     if ($this->isNewRecord) {
         $this->created_at = time();
     }
     $this->updated_at = time();
     $this->office_id = (int) $_GET['oid'];
     if (!Office::model()->findByPk($this->office_id)->isMyOffice()) {
         throw new CException("Smart eh?", 404);
     }
     $this->user_id = Yii::app()->user->id;
     return parent::beforeValidate();
 }
Beispiel #16
0
echo $form->label($model, 'fathers_name');
?>
		<?php 
echo $form->textField($model, 'fathers_name', array('size' => 40, 'maxlength' => 40));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'office');
?>
		<?php 
//echo $form->textField($model,'office');
?>
        <?php 
echo $form->dropDownList($model, 'office', CHtml::listData(Office::model()->findAll(), 'of_id', 'of_name'), array('prompt' => 'Select office'));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'department');
?>
		<?php 
//echo $form->textField($model,'department');
?>
        <?php 
echo $form->dropDownList($model, 'department', CHtml::listData(Department::model()->findAll(), 'dep_id', 'dep_name'), array('prompt' => 'Select department'));
?>
	</div>
Beispiel #17
0
<?php

/**
 * @var $this SiteController
 *
 */
/** @var  $isMobile \Device */
$isMobile = Yii::app()->device->isDevice('mobile');
$this->pageTitle = 'Contacts';
/** @var $offices Office[] */
$offices = Office::model()->with(array("branches" => array('condition' => "bra_status = 'Active' AND business_unit is not null AND business_unit > 0")))->findAll();
$pageGalleryImages = PageGalleryImage::model()->officePhotos()->findAll();
$imagePath = Yii::app()->params['imgUrl'] . "/ContactPageGallery/1/";
?>
<div class="detail-box-listings contact-page">
	<?php 
if ($pageGalleryImages) {
    ?>

		<div class="slider-container">
			<div class="slider">
				<?php 
    foreach ($pageGalleryImages as $key => $pageGalleryImage) {
        $fullThumbImagePath = $imagePath . $pageGalleryImage->fullName;
        $fullOrgImagePath = $imagePath . $pageGalleryImage->name;
        ?>
					<div class="item item<?php 
        echo $key;
        ?>
">
						<a href="<?php