public function getCMSFields()
 {
     $fields = FieldList::create(TabSet::create('Root'));
     $fields->addFieldsToTab('Root.Main', array(TextField::create('Title'), TextareaField::create('Description'), DropdownField::create('CategoryID', 'Category')->setSource(DirectoryCategory::get()->map('ID', 'Title'))->setEmptyString('-- Select a category --'), TextField::create('Manager'), TextareaField::create('Address'), TextField::create('City'), CountryDropdownField::create('Country'), TextField::create('Website'), TextField::create('Email'), TextField::create('Phone'), DateField::create('Date')->setConfig('showcalendar', true)->setConfig('dateformat', 'd MMMM yyyy')));
     $fields->addFieldToTab('Root.Photos', $upload = UploadField::create('Photo', 'Photo'));
     $upload->getValidator()->setAllowedExtensions(array('png', 'jpeg', 'jpg', 'gif'));
     $upload->setFolderName('directory-photos');
     return $fields;
 }
예제 #2
0
 public static function getDirectoryCategory($id)
 {
     $value = DirectoryCategory::model()->findByAttributes(array('id' => $id));
     if (empty($value->title)) {
         return 'Root';
     } else {
         return $value->title;
     }
 }
예제 #3
0
        <h5>Manage Directory Categories</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-search"></i>', '#', array('class' => 'search-button', 'data-rel' => 'tooltip', 'title' => 'Search', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <div class="search-form" style="display:none">
                <?php 
$this->renderPartial('_search', array('model' => $model));
?>
            </div><!-- search-form -->
            <?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'directory-category-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'parent', 'type' => 'raw', 'value' => 'DirectoryCategory::getDirectoryCategory($data->parent)', 'filter' => DirectoryCategory::get_category_new('DirectoryCategory', 'parent'), 'htmlOptions' => array('style' => "text-align:left;width:200px;", 'title' => 'Parent Category')), 'title', array('name' => 'published', 'header' => "Status", 'value' => '$data->published?Yii::t(\'app\',\'Yes\'):Yii::t(\'app\', \'No\')', 'filter' => array('' => Yii::t('app', 'All'), '0' => Yii::t('app', 'No'), '1' => Yii::t('app', 'Yes')), 'htmlOptions' => array('style' => "text-align:center;width:100px;")), array('header' => 'Actions', 'class' => 'bootstrap.widgets.TbButtonColumn'))));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
예제 #4
0
/* @var $this EdirectoryController */
/* @var $model Edirectory */
/* @var $form CActiveForm */
?>

<div class="wide form">
    <?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get'));
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile(Yii::app()->theme->baseUrl . '/assets/js/jquery.chained.js', CClientScript::POS_END);
Yii::app()->clientScript->registerScript('chain-select', " \n    \$('#Edirectory_state').chained('#Edirectory_country');\n    \$('#Edirectory_city').chained('#Edirectory_state');\n    \$('#Edirectory_district').chained('#Edirectory_city');\n    \$('#Edirectory_thana').chained('#Edirectory_district');\n    ");
?>
    <div class="row-fluid">
        <div class="span12">
            <?php 
echo DirectoryCategory::get_category_new('Edirectory', 'category');
?>
        </div>
    </div>
    <?php 
echo $form->textFieldControlGroup($model, 'title', array('span' => 5, 'maxlength' => 255));
?>
    <?php 
echo $form->textFieldControlGroup($model, 'address', array('span' => 5, 'maxlength' => 255));
?>
    <?php 
echo $form->textFieldControlGroup($model, 'telephone', array('span' => 5, 'maxlength' => 255));
?>
    <?php 
echo $form->textFieldControlGroup($model, 'mobile', array('span' => 5, 'maxlength' => 100));
?>
예제 #5
0
<div class="widget-box">
    <div class="widget-header">
        <h5>Details Directory Category (<?php 
echo $model->title;
?>
)</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-pencil"></i>', array('update', 'id' => $model->id), array('data-rel' => 'tooltip', 'title' => 'Edit', 'data-placement' => 'bottom'));
?>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <?php 
$this->widget('zii.widgets.CDetailView', array('htmlOptions' => array('class' => 'table table-striped table-condensed table-hover'), 'data' => $model, 'attributes' => array('id', array('name' => 'parent', 'type' => 'raw', 'value' => DirectoryCategory::getDirectoryCategory($model->parent)), 'title', 'details', array('name' => 'created_by', 'type' => 'raw', 'value' => UserAdmin::get_name($model->created_by)), array('name' => 'created_on', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->created_on)), array('name' => 'published', 'value' => $model->published ? "Yes" : "No"))));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
예제 #6
0
        <h5>Manage Directories</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-search"></i>', '#', array('class' => 'search-button', 'data-rel' => 'tooltip', 'title' => 'Search', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <div class="search-form" style="display:none">
                <?php 
$this->renderPartial('_search', array('model' => $model));
?>
            </div><!-- search-form -->
            <?php 
$this->widget('bootstrap.widgets.TbGridView', array('id' => 'edirectory-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'category', 'type' => 'raw', 'value' => 'DirectoryCategory::getDirectoryCategory($data->category)', 'filter' => DirectoryCategory::get_category_new('Edirectory', 'category'), 'htmlOptions' => array('style' => "text-align:left;width:150px;", 'title' => 'Category')), 'title', 'telephone', 'mobile', 'email', array('name' => 'published', 'header' => "Status", 'value' => '$data->published?Yii::t(\'app\',\'Active\'):Yii::t(\'app\', \'Inactive\')', 'filter' => array('' => Yii::t('app', 'All'), '0' => Yii::t('app', 'Inactive'), '1' => Yii::t('app', 'Active')), 'htmlOptions' => array('style' => "text-align:center;width:100px;")), array('header' => 'Actions', 'class' => 'bootstrap.widgets.TbButtonColumn'))));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
예제 #7
0
<div class="widget-box">
    <div class="widget-header">
        <h5>Details Directory (<?php 
echo $model->title;
?>
)</h5>
        <div class="widget-toolbar">
            <a data-action="settings" href="#"><i class="icon-cog"></i></a>
            <a data-action="reload" href="#"><i class="icon-refresh"></i></a>
            <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a>
            <a data-action="close" href="#"><i class="icon-remove"></i></a>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-pencil"></i>', array('update', 'id' => $model->id), array('data-rel' => 'tooltip', 'title' => 'Edit', 'data-placement' => 'bottom'));
?>
        </div>
        <div class="widget-toolbar">
            <?php 
echo CHtml::link('<i class="icon-plus"></i>', array('create'), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom'));
?>
        </div>
    </div><!--/.widget-header -->
    <div class="widget-body">
        <div class="widget-main">
            <?php 
$this->widget('zii.widgets.CDetailView', array('htmlOptions' => array('class' => 'table table-striped table-condensed table-hover'), 'data' => $model, 'attributes' => array('id', array('name' => 'category', 'type' => 'raw', 'value' => DirectoryCategory::getDirectoryCategory($model->category)), 'title', 'address', 'postcode', array('name' => 'country', 'type' => 'raw', 'value' => Country::getCountry($model->country)), array('name' => 'state', 'type' => 'raw', 'value' => State::getState($model->state)), array('name' => 'city', 'type' => 'raw', 'value' => City::getCity($model->city)), array('name' => 'district', 'type' => 'raw', 'value' => District::getDistrict($model->district)), array('name' => 'thana', 'type' => 'raw', 'value' => Thana::getThana($model->thana)), 'telephone', 'mobile', 'email', 'fax', 'website', 'details', array('name' => 'created_by', 'type' => 'raw', 'value' => UserAdmin::get_user_name($model->created_by)), array('name' => 'created_on', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->created_on)), array('name' => 'modified_by', 'type' => 'raw', 'value' => UserAdmin::get_user_name($model->modified_by)), array('name' => 'modified_on', 'type' => 'raw', 'value' => UserAdmin::get_date_time($model->modified_on)), array('name' => 'published', 'value' => $model->published ? "Yes" : "No"), 'hits')));
?>
        </div>
    </div><!--/.widget-body -->
</div><!--/.widget-box -->
 public function CategoryList()
 {
     return DirectoryCategory::get();
 }
 /**
  * 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 $id the ID of the model to be loaded
  * @return DirectoryCategory the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = DirectoryCategory::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #10
0
<p class="help-block">Fields with <span class="required">*</span> are required.</p>

<?php 
echo $form->errorSummary($model);
?>

<?php 
echo $form->labelEx($model, 'category');
?>
<div class="row-fluid">
    <div class="span12">
        <?php 
if ($model->isNewRecord) {
    echo DirectoryCategory::get_category_new('Edirectory', 'category');
} else {
    echo DirectoryCategory::get_category_update('Edirectory', 'category', $model->category);
}
?>
    </div>
</div>
<?php 
echo $form->textFieldControlGroup($model, 'title', array('span' => 5, 'maxlength' => 255));
?>
    
<?php 
echo $form->textFieldControlGroup($model, 'telephone', array('span' => 5, 'maxlength' => 255));
echo $form->textFieldControlGroup($model, 'mobile', array('span' => 5, 'maxlength' => 100));
echo $form->textFieldControlGroup($model, 'email', array('span' => 5, 'maxlength' => 255));
echo $form->textFieldControlGroup($model, 'fax', array('span' => 5, 'maxlength' => 255));
echo $form->textFieldControlGroup($model, 'website', array('span' => 5, 'maxlength' => 255));
echo $form->textFieldControlGroup($model, 'address', array('span' => 5, 'maxlength' => 255));
예제 #11
0
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'directory-category-form', 'enableAjaxValidation' => false));
?>
    <p class="help-block">Fields with <span class="required">*</span> are required.</p>
    <?php 
echo $form->errorSummary($model);
?>
    <?php 
echo $form->labelEx($model, 'parent');
?>
    <div class="row-fluid">
        <div class="span12">
            <?php 
if ($model->isNewRecord) {
    echo DirectoryCategory::get_category_new('DirectoryCategory', 'catid');
} else {
    echo DirectoryCategory::get_category_update('DirectoryCategory', 'parent', $model->parent);
}
?>
        </div>
    </div>
    <?php 
echo $form->textFieldControlGroup($model, 'title', array('span' => 5, 'maxlength' => 250));
?>
    <?php 
echo $form->labelEx($model, 'details');
?>
    <?php 
$this->widget('application.extensions.xheditor.JXHEditor', array('model' => $model, 'attribute' => 'details', 'htmlOptions' => array('class' => 'xheditor', 'style' => 'width: 100%; height: 150px;')));
?>
    <?php 
echo $form->dropDownListControlGroup($model, 'published', array('1' => 'Yes', '0' => 'No'));