Example #1
0
</fieldset>
<fieldset>
<?php 
foreach ($model->getThemes() as $theme => $options) {
    $attribute = $theme == 'desktop' ? 'theme' : $theme . 'Theme';
    $elements = array();
    $elementOptions = array('options' => array());
    // Allow themes to be empty for non desktop theme
    if ($attribute !== 'theme') {
        $elements = array(NULL);
        $elementOptions = array('options' => array(array('value' => NULL)));
    }
    foreach ($options as $k => $v) {
        $themeFolder = str_replace('webroot.themes.', '', $v['folder']);
        $elements[] = $themeFolder;
        // This image SHOULD be publicly accessible at this location assuming you have a half sane setup
        $elementOptions['options'][] = array('value' => $themeFolder, 'data-img-src' => Yii::app()->getBaseUrl(true) . '/themes/' . $themeFolder . '/default.png', 'selected' => Cii::getConfig($attribute) == $themeFolder ? 'selected' : null);
    }
    echo CHtml::openTag('div', array('class' => 'pure-form-group', 'style' => 'padding-bottom: 20px'));
    echo CHtml::tag('legend', array(), Cii::titleize($attribute));
    echo $form->dropDownListRow($model, $attribute, $elements, $elementOptions);
    if (count($options) == 0) {
        echo CHtml::tag('div', array('class' => 'row noItemsMessage'), CHtml::tag('span', array(), Yii::t('Dashboard.views', 'There are no themes installed for this category.')));
    }
    echo CHtml::closeTag('div');
}
?>
</fieldset>

<?php 
Yii::app()->getClientScript()->registerCssFile($this->asset . '/css/image-picker.css')->registerScriptFile($this->asset . '/js/image-picker.min.js', CClientScript::POS_END)->registerCss('no-labels', 'label { display: none; }');
Example #2
0
    /**
     * Renders the main body content
     * @param  CActiveForm $Form  The Form we're working with
     */
    private function renderMain($form)
    {
        // #main .content
        echo CHtml::openTag('div', array('id' => 'main', 'class' => 'nano'));
        echo CHtml::openTag('div', array('class' => 'content'));
        echo CHtml::openTag('fieldset');
        // If we want a custom form view, render that view instead of the default behavior
        if ($this->model->form !== NULL) {
            $this->controller->renderPartial($this->model->form, array('model' => $this->model, 'properties' => $this->properties, 'form' => $form));
        } else {
            if (count($this->properties) == 0 && $this->model->preContentView == NULL) {
                echo CHtml::tag('legend', array(), Yii::t('Dashboard.main', 'Change Theme Settings'));
                echo CHtml::tag('div', array('class' => 'alert alert-info'), Yii::t('Dashboard.main', 'There are no settings for this section.'));
            } else {
                $groups = $this->model->groups();
                if (!empty($groups)) {
                    foreach ($groups as $name => $attributes) {
                        echo CHtml::tag('legend', array(), $name);
                        echo CHtml::tag('div', array('class' => 'clearfix'), NULL);
                        foreach ($attributes as $property) {
                            $p = new StdClass();
                            $p->name = $property;
                            $this->renderProperties($form, $p);
                        }
                    }
                } else {
                    echo CHtml::tag('legend', array(), Cii::titleize(get_class($this->model)));
                    foreach ($this->properties as $property) {
                        $this->renderProperties($form, $property);
                    }
                }
                echo CHtml::tag('button', array('id' => 'header-button', 'escape' => false, 'class' => 'pure-button pure-button-primary pure-button-small pull-right'), CHtml::tag('i', array('class' => 'icon-spinner icon-spin icon-spinner-form2', 'style' => 'display: none'), NULL) . $this->header['save-text']);
            }
        }
        echo CHtml::closeTag('div');
        echo CHtml::closeTag('div');
        echo CHtml::closeTag('div');
        Yii::app()->getClientScript()->registerScript('change', '
			$("input:not([no-field-change=\'true\']").on("input onpropertychange change", function() {

				try {
					$(".icon-spinner-form2").fadeIn();
					clearTimeout(timeout);
				} catch (e) {}
				
				timeout = setTimeout(function() {

					var values = $("form").serializeArray();

				    $("form input[type=checkbox]:not(:checked)").each(function() {
				    	values.push({ "name" : this.name, "value" : 0 })
				    });

					$.post($("form").attr("action"), values, function(data, textStatus) {
						var d = $("#yw2", $.parseHTML(data));

						$("#yw2").html($(d).html());						
						$(".alert").not(".alert-secondary").fadeIn(1000);
						$(".icon-spinner-form2").fadeOut();
						setTimeout(function() { $(".alert").not(".alert-secondary").fadeOut(1000); }, 5000);
					});

				}, 1000);

			});
		');
    }
Example #3
0
 /**
  * Retrieves any issues with the present CiiMS instance.
  *
  * This checks several things
  * 1) The current CiiMS version as compared to the installed version
  * 2) Whether or there are missing migrations
  * 3) If there are any permissions problems
  */
 public function actionGetIssues()
 {
     $issues = array();
     // Check CiiMS version
     $curl = curl_init();
     curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => 'https://raw.github.com/charlesportwoodii/CiiMS/latest-version/protected/extensions/cii/ciims.json'));
     $json = CJSON::decode(curl_exec($curl));
     if ($json['version'] > Cii::getVersion()) {
         $issues[] = array('issue' => 'version', 'message' => Yii::t('Dashboard.main', 'CiiMS is out of date. Please update to the latest version ({{version}})', array('{{version}}' => CHtml::link($json['version'], 'https://github.com/charlesportwoodii/CiiMS/tree/latest-version/', array('target' => '_blank')))));
     }
     // Check if migrations have been run
     $migrations = Yii::app()->db->createCommand('SELECT COUNT(*) as count FROM tbl_migration')->queryScalar();
     $fileHelper = new CFileHelper();
     $files = count($fileHelper->findFiles(Yii::getPathOfAlias('application.migrations'), array('fileTypes' => array('php'), 'level' => 1)));
     if ($migrations < $files) {
         $issues[] = array('issue' => 'migrations', 'message' => Yii::t('Dashboard.main', "CiiMS' database is out of date. Please run yiic migrate up to migrate your database to the latest version."));
     }
     // Check common permission problems
     if (!is_writable(Yii::getPathOfAlias('webroot.uploads'))) {
         $issues[] = array('issue' => 'permssions', 'message' => Yii::t('Dashboard.main', 'Your uploads folder ({{folder}}) is not writable. Please change the permissions on the folder to be writable', array('{{folder}}' => Yii::getPathOfAlias('webroot.uploads'))));
     }
     if (!is_writable(Yii::getPathOfAlias('application.runtime'))) {
         $issues[] = array('issue' => 'permssions', 'message' => Yii::t('Dashboard.main', 'Your runtime folder ({{folder}}) is not writable. Please change the permissions on the folder to be writable', array('{{folder}}' => Yii::getPathOfAlias('application.runtime'))));
     }
     if (count($issues) == 0) {
         echo CHtml::tag('div', array('class' => 'alert in alert-block fade alert-success'), Yii::t('Dashboard.main', 'There are no issues with your system. =)'));
     } else {
         echo CHtml::tag('div', array('class' => 'alert in alert-block fade alert-error'), Yii::t('Dashboard.main', 'Please address the following issues.'));
     }
     foreach ($issues as $issue) {
         echo CHtml::openTag('div', array('class' => 'pure-control-group'));
         echo CHtml::tag('label', array(), Cii::titleize($issue['issue']));
         echo CHtml::tag('span', array('class' => 'inline'), $issue['message']);
         echo CHtml::closeTag('div');
     }
     return;
 }
Example #4
0
foreach ($model->metadata as $meta) {
    ?>
						<?php 
    if (strpos($meta->key, 'api_key') !== false) {
        continue;
    }
    // Prevent API keys from being displayed or manipulated
    ?>
						<?php 
    $options = array('class' => 'pure-input-2-3', 'type' => 'text', 'value' => $meta->value, 'name' => 'UserMetadata[' . $meta->key . ']');
    ?>

						<div class="pure-control-group">
							<!-- TODO: Find a way to hide dashboard items as they cause the dashboard to explode... -->
							<?php 
    echo CHtml::tag('label', array(), Cii::titleize($meta->key));
    ?>

							<?php 
    if (strpos($meta->key, 'Provider') !== false) {
        ?>
								<?php 
        $options['disabled'] = true;
        ?>
							<?php 
    } elseif ($meta->key == 'likes') {
        ?>
								<?php 
        $options['disabled'] = true;
        ?>
								<?php 
 /**
  * Automatically bind some Javascript black magic!
  * Since _nearly_ every page has a bunch of javascript, all javascript for a particular controller 
  * is now wrapped up in modules.dashboard.assets.js.dashboard.<controller>.js
  *
  * This makes management of the code _very_ friendly and easy to handle. Additionally, it separates
  * out the js and the php code
  *
  * This deliberately occurs afterRender because script order does matter for the dashboard. This really needs to be dead last
  */
 protected function afterRender($view, &$output)
 {
     Yii::app()->clientScript->registerScriptFile($this->asset . '/js/dashboard/' . $this->id . '.js', CClientScript::POS_END);
     Yii::app()->clientScript->registerScript($this->id . '_' . $this->action->id, '$(document).ready(function() { CiiDashboard.' . Cii::titleize($this->id) . '.load' . Cii::titleize($this->action->id) . '(); });', CCLientScript::POS_END);
 }
Example #6
0
			<legend><?php 
echo Yii::t('Dashboard.views', 'Active Cards');
?>
</legend>

			<div class="meta-container">
				<?php 
foreach ($cards as $card) {
    ?>
					<?php 
    $card->value = CJSON::decode($card->value);
    ?>
					<div class="pure-control-group">
						<?php 
    echo CHtml::tag('label', array('class' => 'inline'), Cii::titleize($card->value['class']));
    ?>
						<?php 
    $count = Cards::model()->countByAttributes(array('name' => $card->key));
    ?>
						<p class="text-small inline" style="top: -8px;"><?php 
    echo $card->value['name'];
    ?>
</p>
						<span class="pure-button pure-button-error pure-button-xsmall pure-button-link-xs pull-right remove-button" id="<?php 
    echo $card->key;
    ?>
">
							<span class="icon-remove"></span>
						</span>
						<span class="pure-button pure-button-warning pure-button-xsmall pure-button-link-xs pull-right">