Archiv

Autor Archiv

Brainstorming App

2. Februar 2012

Ganz einfache Sache. Mittels Brainstorming sollen Ideen und Lösungsvorschläge gefunden werden. Jeder kann Fragen, Probleme posten und jeder kann auch Ideen, Kommentare abliefern. Als Datenbank wird hier SQLite verwendet, somit ist keine Installation notwendig.

Author: Categories: Prototypen, Yii Tags:

isUTF8

26. Januar 2012
function isUTF8($str)
{
  return preg_match('/^([\x09\x0A\x0D\x20-\x7E]|[\xC2][\xA0-\xBF]|[\xC3-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2})*$/', $str);
}
Author: Categories: PHP Tags:

CDetailView in Sidebar anzeigen

24. Januar 2012

Problem:

die th-Spalte im DetailView ist per CSS 160px breit, passt nicht so einfach in eine schmale Sidebar

Lösung:

class UserInfo extends CWidget
{
  public $user;
 
  public function run()
  {
    Yii::app()->clientScript->registerCss('sidebar', 'table.sidebar th {width: 100px;}');
    $this->widget('zii.widgets.CDetailView', array(
      'data' => $this->user,
      'htmlOptions' => array('class' => 'detail-view sidebar'),
      'attributes' => array(
        'firstname',
        'lastname'
      ),
    ));
  }
}
Author: Categories: Yii Tags:

jQueryUI-Theme ändern

23. Januar 2012

Theme hier runterladen.
Den Ordner redmond nach framework/web/js/source/jui/css kopieren.
Datei jquery-ui-1.8.17.custom.css umbenennen in jquery-ui.css.
Assets-Ordner leeren.

//framework/zii/widgets/jui/CJuiWidget.php
public $theme='redmond';
//view.php
$this->beginWidget('zii.widgets.jui.CJuiDialog', array(
    'id'=>'mydialog',
    // additional javascript options for the dialog plugin
    'options'=>array(
        'title'=>'Dialog box 1',
        'autoOpen'=>false,
    ),
));
 
    echo 'dialog content here';
 
$this->endWidget('zii.widgets.jui.CJuiDialog');
 
// the link that may open the dialog
echo CHtml::link('open dialog', '#', array(
   'onclick'=>'$("#mydialog").dialog("open"); return false;',
));
Author: Categories: Yii Tags:

Highcharts

19. Januar 2012

Diagramme erstellen kann man mit der Highcharts-Extension:

 

Author: Categories: Yii Tags:

renderPortlets

16. Januar 2012
//views/layouts.main.php
<div class="span-6 last">
  <div id="sidebar">
    <?php $this->renderPortlets('right'); ?>
  </div>
</div>
//components/Controller.php
class Controller extends CController
{   
  public $portlets = array();
 
  public function addPortlet($position, $portlet)
  {
    $this->portlets[$position][] = $portlet;
  }
 
  public function renderPortlets($position)
  {
    if (isset($this->portlets[$position])) {
      foreach ($this->portlets[$position] as $portlet) {
        $this->beginWidget('zii.widgets.CPortlet', array(
          'title' => $portlet['title'],
        ));
        $this->widget($portlet['class'], $portlet['params']);
        $this->endWidget();
      }
    }
  }
}
//views/article/view.php
$this->addPortlet('right', array(
  'class' => 'zii.widgets.CMenu',
  'title' => 'Operations',
  'params' => array( //Configuration CMenu
    'items' => array(
      array('label' => 'List Article', 'url' => array('index')),
      array('label' => 'Create Article', 'url' => array('create')),
      array('label' => 'Update Article', 'url' => array('update', 'id' => $model->id)),
      array('label' => 'Delete Article', 'url' => '#', 'linkOptions' => array('submit' =>
        array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')),
      ),
    'htmlOptions' => array('class' => 'operations')
  )
));
 
$this->addPortlet('right', array(
  'class' => 'ArticleInfoWidget',
  'title' => 'ArticleInfo',
  'params' => array(
    'article' => $model
  )
));
Author: Categories: Yii Tags: ,

3-spaltiges Layout

7. Januar 2012
//css/main.css
#sidebar-left
{
    padding: 20px 0 20px 20px;
}
//protected/views/layouts/column3.php
<?php $this->beginContent('//layouts/main'); ?>
<div class="container">
 
    <div class="span-6">
        <div id="sidebar-left">
	    <?php $this->renderPortlets('left'); ?>
	</div>
    </div>
 
    <div class="span-12">
        <div id="content">
            <?php echo $content; ?>
	</div>
    </div>
 
    <div class="span-6 last">
        <div id="sidebar">
	    <?php $this->renderPortlets('right'); ?>
	</div>
    </div>
 
</div>
<?php $this->endContent(); ?>
//Controller.php
public $layout = '//layouts/column3';
Author: Categories: Yii Tags: