예제 #1
0
 /**
  * This method returns the project types for the given id.
  * Returns model if successfully found. 
  * Returns false if not found.
  * 
  * @return model || false
  */
 public static function getProjectTypeById($Id)
 {
     $projectType = ProjectTypes::model()->findByPk($Id);
     if ($projectType) {
         return $projectType->project_type;
     } else {
         return false;
     }
 }
예제 #2
0
<ul class="acc" id="acc2">
	<li>
	<h3>Basic Details</h3>
	<div class="acc-section">
	<table width="92%" border="0" cellpadding="0" cellspacing="0" align="center">
		<tr>
			<td><input type="checkbox" value="1" name="new_launches" <?php 
echo $launchesChecked;
?>
>
			<label>New launches</label>
			</td>
		</tr>
		<tr>
			<td><label>Project Type</label> <?php 
echo $form->dropDownList($modelProject, 'project_type_id', CHtml::listData(ProjectTypes::model()->findAll(), 'id', 'project_type'), array('class' => 'select_box', 'empty' => 'All'));
?>
			</td>
		</tr>
		<tr>
			<td>Keyword(s)<input type="text" name="keyword" class="txt-box1" value="<?php 
echo isset($_POST['keyword']) ? $_POST['keyword'] : '';
?>
" /></td>
		</tr>
		</table>
		</div>
	</li>
	<li>
		<h3>Location</h3>	
		<div class="acc-section">
예제 #3
0
파일: update.php 프로젝트: romeo14/wallfeet
<span class="required">*</span></span> <?php 
echo $form->textArea($model, 'company_description', array('class' => 'txtarea'));
?>
	</li>
	<li class="error_message"><?php 
echo $form->error($model, 'company_description');
?>
</li>
</ul>
</fieldset>
<fieldset><legend>Deals In</legend>
<ul>
	<li><span><label for="Property_description" class="required">Property Type <span class="required">*</span></label></span>
		<div class="multi_checkbox avg">
			<?php 
echo CHtml::checkBoxList('project_type_id', $projecttypes, CHtml::listData(ProjectTypes::model()->findAll(), 'id', 'project_type'));
?>
		</div>
	</li>
	<li class="error_message"><?php 
echo $form->error($projectType, 'project_type_id');
?>
</li>
</ul>
<?php 
if ($locationCityIds) {
    $i = 0;
    $data = 'City';
    foreach ($locationCityIds as $i => $location) {
        if ($i > 0) {
            $data = '&nbsp';
 public function actionFind()
 {
     $location = Yii::app()->Ini->getlocationbyip(Yii::app()->Ini->rip('ip'));
     $projects = Projecttypes::model()->findAll(array('order' => 'Name ASC'));
     $criteria = new CDbCriteria();
     $criteria->order = "question_id DESC";
     $criteria->limit = 5;
     $questions = Questions::model()->findAll($criteria);
     $states = States::model()->findAll(array('order' => 'Name ASC'));
     $city = Yii::app()->Ini->v('city');
     $project = Yii::app()->Ini->v('project');
     $zipcode = Yii::app()->Ini->v('zipcode');
     $match = Yii::app()->Ini->v('match');
     $homeowner_projects = $this->getHomeOwnerProjects();
     $pie = new SimplePie();
     $pie->set_feed_url('http://media.handyman.com/feed/');
     $pie->init();
     $pie->handle_content_type();
     if ($city) {
         $details = Cities::model()->findByAttributes(array('RewriteUrl' => $city . "/"));
         if (count($details) > 0) {
             $city_name = $details->Name;
         } else {
             $city_name = "";
         }
         $criteria = new CDbCriteria();
         $criteria->condition = "City like '%{$city_name}%'";
         $count = Contractors::model()->count($criteria);
         $pages = new CPagination($count);
         // results per page
         $pages->pageSize = 5;
         $pages->applyLimit($criteria);
         $models = Contractors::model()->findAll($criteria);
         $this->render('find_result', array('models' => $models, 'pages' => $pages, 'projects' => $projects, 'records' => $count, 'city_name' => $city_name, 'location' => $city_name . ",USA", 'questions' => $questions, 'homeowner_projects' => $homeowner_projects, 'feed' => $pie));
     } else {
         if ($project && $zipcode) {
             $details = Projecttypes::model()->findByAttributes(array('ProjectTypeId' => $project));
             if (count($details) > 0) {
                 $oid = $details->OID;
                 $city_name = $details->Name;
                 $home_advisor = Yii::app()->Ini->searchhomeadvisor($zipcode, $oid);
                 //$home_advisor = Yii::app()->Ini->searchhomeadvisor('11741','12005');
                 if ($home_advisor == false) {
                     $home_advisor_results = false;
                 } else {
                     $home_advisor_results = $home_advisor['serviceProvider'];
                 }
             }
             $criteria = new CDbCriteria();
             $criteria->condition = "ProjectTypeId='" . $project . "' AND Zip='" . $zipcode . "'";
             $count = Contractors::model()->count($criteria);
             $pages = new CPagination($count);
             // results per page
             $pages->pageSize = 5;
             $pages->applyLimit($criteria);
             $models = Contractors::model()->findAll($criteria);
             $this->render('match-result', array('pages' => $pages, 'result' => $models, 'home_advisors' => $home_advisor_results, 'projects' => $projects, 'states' => $states, 'location' => $location, 'city_name' => $city_name . ' In Zipcode ' . $zipcode, 'questions' => $questions, 'feed' => $pie));
         } else {
             if ($project) {
                 $details = Projecttypes::model()->findByAttributes(array('ProjectTypeId' => $project));
                 if (count($details) > 0) {
                     $city_name = $details->Name;
                 }
                 $criteria = new CDbCriteria();
                 $criteria->condition = "ProjectTypeId=" . $project;
                 $count = Contractors::model()->count($criteria);
                 $pages = new CPagination($count);
                 // results per page
                 $pages->pageSize = 5;
                 $pages->applyLimit($criteria);
                 $models = Contractors::model()->findAll($criteria);
                 $this->render('find_result', array('models' => $models, 'pages' => $pages, 'projects' => $projects, 'records' => $count, 'city_name' => $city_name, 'location' => $location, 'questions' => $questions, 'homeowner_projects' => $homeowner_projects, 'feed' => $pie));
             } else {
                 if ($zipcode) {
                     $criteria = new CDbCriteria();
                     $criteria->condition = "Zip='{$zipcode}'";
                     $count = Contractors::model()->count($criteria);
                     $pages = new CPagination($count);
                     // results per page
                     $pages->pageSize = 5;
                     $pages->applyLimit($criteria);
                     $models = Contractors::model()->findAll($criteria);
                     $this->render('find_result', array('models' => $models, 'pages' => $pages, 'projects' => $projects, 'records' => $count, 'city_name' => $zipcode, 'questions' => $questions, 'homeowner_projects' => $homeowner_projects, 'feed' => $pie));
                 } else {
                     if ($match) {
                         $proj = Projects::model()->findByPk($match);
                         if (count($proj) > 0) {
                             $proj_zipcode = $proj->zipcode;
                             $project_type_id = $proj->project_type_id;
                             $criteria = new CDbCriteria();
                             $criteria->condition = "ProjectTypeId='" . $project_type_id . "' AND Zip = '" . $proj_zipcode . "'";
                             $count = Contractors::model()->count($criteria);
                             $pages = new CPagination($count);
                             $result = Contractors::model()->findAll($criteria);
                             $projecttypes = ProjectTypes::model()->findByPK($project_type_id);
                             $proj_oid = $projecttypes->OID;
                             //$proj_zipcode = '11741';
                             //$proj_oid = '12070';
                             $home_advisor = Yii::app()->Ini->searchhomeadvisor($proj_zipcode, $proj_oid);
                             if ($home_advisor == false) {
                                 $home_advisor_results = false;
                             } else {
                                 $home_advisor_results = $home_advisor['serviceProvider'];
                             }
                             $this->render('match-result', array('pages' => $pages, 'result' => $result, 'home_advisors' => $home_advisor_results, 'projects' => $projects, 'states' => $states, 'location' => $location, 'city_name' => $this->getProjectTypeName($project_type_id) . ' In Zipcode ' . $proj_zipcode, 'questions' => $questions, 'feed' => $pie));
                         } else {
                             $this->render('find_form', array('projects' => $projects, 'states' => $states, 'location' => $location, 'questions' => $questions));
                         }
                     } else {
                         $this->render('find_form', array('projects' => $projects, 'states' => $states, 'location' => $location, 'questions' => $questions, 'feed' => $pie));
                     }
                 }
             }
         }
     }
 }
예제 #5
0
 /**
  * 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 = ProjectTypes::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #6
0
파일: _form.php 프로젝트: romeo14/wallfeet
echo $form->labelEx($model, 'description');
?>
		<?php 
echo $form->textArea($model, 'description', array('rows' => 6, 'cols' => 50));
?>
		<?php 
echo $form->error($model, 'description');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'project_type_id');
?>
		<?php 
echo $form->dropDownList($model, 'project_type_id', CHtml::listData(ProjectTypes::model()->findAll(), 'id', 'project_type'), array('empty' => 'Select'));
?>
		<?php 
echo $form->error($model, 'project_type_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'ownership_type_id');
?>
		<?php 
echo $form->dropDownList($model, 'ownership_type_id', CHtml::listData(CategoryOwnershipTypes::model()->findAll(), 'id', 'ownership_type'), array('empty' => 'Select'));
?>
		<?php 
echo $form->error($model, 'ownership_type_id');