/** * When widget is called, following function is run. */ public function run() { // retrieve data from the global storage $data = MLinkList::get($this->id); // the new array of the links is a validated one $links = array(); if (isset($data['links']) && is_array($data['links'])) { foreach ($data['links'] as $link) { if (isset($link['visible']) && !$link['visible']) { continue; } if (is_array($link) && (isset($link['text']) || isset($link['url']) || isset($link['icon']) || isset($link['options']))) { $links[] = array('text' => isset($link['text']) ? (string) $link['text'] : '', 'url' => isset($link['url']) && (is_array($link['url']) || is_string($link['url'])) ? $link['url'] : '#', 'options' => isset($link['options']) && is_array($link['options']) ? $link['options'] : array()); $i = count($links) - 1; if (isset($link['icon']) && (is_string($link['icon']) || is_numeric($link['icon']))) { $links[$i]['icon'] = $link['icon']; } if (!isset($links[$i]['options']['title'])) { $links[$i]['options']['title'] = $links[$i]['text']; } } } } // do not display the widget if the data has no links if (($c = count($links)) === 0) { return null; } // set the default values and validate the data $area = $this->area === null ? $this->id : $this->area; if ($this->displayTitlebar === null) { $this->displayTitlebar = isset($data['displayTitlebar']) ? (bool) $data['displayTitlebar'] : true; } if ($this->title === null) { $this->title = isset($data['title']) ? (string) $data['title'] : Yii::t('t', 'Related links'); } else { $this->title = (string) $this->title; } // data for the renderer $data = array('area' => $area, 'c' => $c, 'displayTitlebar' => $this->displayTitlebar, 'links' => $links, 'title' => $this->title, 'class', 'n'); // render the view file $this->render('wLinkList', $data); // update the layout statistics if ($area === 'sidebar1') { MLayout::incrementNumberOfItemsSidebar1(); } else { if ($area === 'sidebar2') { MLayout::incrementNumberOfItemsSidebar2(); } } }
<?php MParams::setPageLabel(Yii::t('page', 'Create a new project')); MUserFlash::setTopError(_CHtml::errorSummary($model)); MLinkList::set('sidebar', array('links' => array(array('text' => Yii::t('link', 'List of projects'), 'url' => array('list'), 'icon' => 'grip-solid-horizontal', 'visible' => false), array('text' => Yii::t('link', 'Grid of projects'), 'url' => array('grid'), 'icon' => 'calculator', 'visible' => Yii::app()->user->checkAccess($this->id . '/grid'))))); $this->widget('application.components.WContentHeader', array('breadcrumbs' => array(array('text' => Yii::t('link', 'Projects'), 'url' => array($this->id . '/' . $this->defaultAction), 'active' => false, 'visible' => Yii::app()->user->checkAccess($this->id . '/' . $this->defaultAction)), array('url' => array($this->action->id), 'active' => true)))); echo $this->renderPartial('_form', array('model' => $model, 'update' => false));
<?php MParams::setPageLabel(Yii::t('page', 'View invoice number "{invoiceNumber}"', array('{invoiceNumber}' => $model->id))); MLinkList::set('sidebar', array('links' => array(array('text' => Yii::t('link', 'Edit invoice'), 'url' => array('update', 'id' => $model->id), 'icon' => 'pencil', 'visible' => Yii::app()->user->checkAccess($this->id . '/update')), array('text' => Yii::t('link', 'List of invoices'), 'url' => array('list'), 'icon' => 'grip-solid-horizontal', 'visible' => false), array('text' => Yii::t('link', 'Grid of invoices'), 'url' => array('grid'), 'icon' => 'calculator', 'visible' => Yii::app()->user->checkAccess($this->id . '/grid')), array('text' => Yii::t('link', 'Create a new invoice'), 'url' => array('create'), 'icon' => 'plus', 'visible' => Yii::app()->user->checkAccess($this->id . '/create'))))); $this->widget('application.components.WContentHeader', array('breadcrumbs' => array(array('text' => Yii::t('link', 'Invoices'), 'url' => array($this->id . '/' . $this->defaultAction), 'active' => false, 'visible' => Yii::app()->user->checkAccess($this->id . '/' . $this->defaultAction)), array('url' => array($this->action->id, 'id' => $model->id), 'active' => true)))); ?> <div class="w3-detail-box ui-widget-content ui-corner-all"> <div class="w3-detail-row w3-first"> <div class="w3-detail-row-label"><?php echo CHtml::encode($model->getAttributeLabel('companyId')); ?> </div> <div class="w3-detail-row-value"><?php echo isset($model->company->id) ? CHtml::link(CHtml::encode($model->company->title), array('company/show', 'id' => $model->company->id)) : ''; ?> </div> <div class="clear"> </div> </div> <div class="w3-detail-row"> <div class="w3-detail-row-label"><?php echo CHtml::encode($model->getAttributeLabel('amountTotal')); ?> </div> <div class="w3-detail-row-value"><?php echo CHtml::encode($model->amountTotal); ?> </div> <div class="clear"> </div> </div> <div class="w3-detail-row">
<?php MParams::setPageLabel(Yii::t('page', 'Change interface')); MUserFlash::setTopError(_CHtml::errorSummary($model)); if (Yii::app()->user->checkAccess(User::ADMINISTRATOR)) { MUserFlash::setSidebarInfo(Yii::t('hint', 'Required: {authRoles}.', array(1, '{authRoles}' => implode(', ', array(Yii::t('t', User::ADMINISTRATOR_T)))))); } MLinkList::set('sidebar', array('links' => array(array('text' => Yii::t('link', 'Show my profile'), 'url' => !$pkIsPassed ? array('show') : array('show', 'id' => $model->id), 'icon' => 'person', 'visible' => $model->isMe), array('text' => Yii::t('link', 'Edit my profile'), 'url' => !$pkIsPassed ? array('update') : array('update', 'id' => $model->id), 'icon' => 'pencil', 'visible' => $model->isMe), array('text' => Yii::t('link', 'Show member'), 'url' => array('show', 'id' => $model->id), 'icon' => 'person', 'visible' => !$model->isMe && Yii::app()->user->checkAccess($this->id . '/show')), array('text' => Yii::t('link', 'Edit member\'s profile'), 'url' => array('update', 'id' => $model->id), 'icon' => 'pencil', 'visible' => !$model->isMe && Yii::app()->user->checkAccess($this->id . '/update')), array('text' => Yii::t('link', 'List of members'), 'url' => array('list'), 'icon' => 'grip-solid-horizontal', 'visible' => false), array('text' => Yii::t('link', 'Grid of members'), 'url' => array('grid'), 'icon' => 'calculator', 'visible' => Yii::app()->user->checkAccess($this->id . '/grid')), array('text' => Yii::t('link', 'Create a new member'), 'url' => array('create'), 'icon' => 'plus', 'visible' => Yii::app()->user->checkAccess($this->id . '/create'))))); $this->widget('application.components.WContentHeader', array('breadcrumbs' => array(array('text' => Yii::t('link', 'Members'), 'url' => array($this->id . '/'), 'active' => false), array('text' => Yii::t('link', 'My profile'), 'url' => $pkIsPassed ? array('show', 'id' => $model->id) : array('show'), 'visible' => $model->isMe), array('text' => Yii::t('link', '"{screenName}" member', array('{screenName}' => $model->screenName)), 'url' => array('show', 'id' => $model->id), 'visible' => !$model->isMe), array('url' => $model->isMe && !$pkIsPassed ? array($this->action->id) : array($this->action->id, 'id' => $model->id), 'active' => true)))); ?> <div class="w3-main-form-box ui-widget-content ui-corner-all"> <?php echo _CHtml::beginForm('', 'post', array('class' => 'w3-main-form')) . "\n"; ?> <div class="w3-form-row w3-first"> <div class="w3-form-row-input"> <div class="w3-form-row-text"> <?php echo _CHtml::activeRadioButtonList($model, 'interface', $model->getAttributeData('interface'), array('template' => '<div style="float: left; height: 145px; text-align: center; width: 160px;">{jqueryUIScreenshot}<br/>{input} {label}</div>', 'separator' => "\n")) . "\n"; ?> </div> </div> <div class="clear"> </div> </div> <div class="w3-form-row w3-last"> <div class="w3-form-row-input w3-form-row-2columns w3-center"> <div class="w3-form-row-text"> <?php echo Yii::t('hint', '{saveButton} or {cancelLink}', array('{saveButton}' => _CHtml::submitButton(Yii::t('link', 'Apply selected user interface'), array('class' => 'w3-input-button w3-button-big ui-state-default ui-corner-all')), '{cancelLink}' => CHtml::link(Yii::t('link', 'Cancel[form]'), $model->isMe && !$pkIsPassed ? array('show') : array('show', 'id' => $model->id)))) . "\n";
<?php MParams::setPageLabel(Yii::t('page', 'Edit time record')); MUserFlash::setTopError(_CHtml::errorSummary($model)); MUserFlash::setSidebarInfo(Yii::t('hint', 'Required: {authRoles}.', $model->invoiceId >= 1 ? array(1, '{authRoles}' => implode(', ', array(Yii::t('t', User::ADMINISTRATOR_T)))) : array(2, '{authRoles}' => implode(', ', array(Yii::t('t', User::MANAGER_T), Yii::t('t', User::ADMINISTRATOR_T)))))); MLinkList::set('sidebar', array('links' => array(array('text' => Yii::t('link', 'Show time record'), 'url' => array('show', 'id' => $model->id), 'icon' => 'zoomin', 'visible' => Yii::app()->user->checkAccess($this->id . '/show')), array('text' => Yii::t('link', 'Delete time record'), 'url' => array('delete', 'id' => $model->id), 'icon' => 'trash', 'visible' => Yii::app()->user->checkAccess($this->id . '/delete', array('model' => $model))), array('text' => Yii::t('link', 'List of time records'), 'url' => array('list'), 'icon' => 'grip-solid-horizontal', 'visible' => false), array('text' => Yii::t('link', 'Grid of time records'), 'url' => array('grid'), 'icon' => 'calculator', 'visible' => Yii::app()->user->checkAccess($this->id . '/grid')), array('text' => Yii::t('link', 'Create a new time record'), 'url' => array('create'), 'icon' => 'plus', 'visible' => Yii::app()->user->checkAccess($this->id . '/create'))))); $this->widget('application.components.WContentHeader', array('breadcrumbs' => array(array('text' => Yii::t('link', 'Time records'), 'url' => array($this->id . '/' . $this->defaultAction), 'active' => false, 'visible' => Yii::app()->user->checkAccess($this->id . '/' . $this->defaultAction)), array('text' => Yii::t('link', '"{title}" time record', array('{title}' => $model->title)), 'url' => array('show', 'id' => $model->id), 'active' => false, 'visible' => Yii::app()->user->checkAccess($this->id . '/show')), array('url' => array($this->action->id, 'id' => $model->id), 'active' => true)))); echo $this->renderPartial('_form', array('model' => $model, 'update' => true));
<?php MParams::setPageLabel(Yii::t('page', 'Grid of time records')); MUserFlash::setSidebarInfo(Yii::t('hint', 'Required: {authRoles}.', array(4, '{authRoles}' => implode(', ', array(Yii::t('t', User::CLIENT_T), Yii::t('t', User::CONSULTANT_T), Yii::t('t', User::MANAGER_T), Yii::t('t', User::ADMINISTRATOR_T)))))); MLinkList::set('sidebar', array('links' => array(array('text' => Yii::t('link', 'View as list'), 'url' => array('list'), 'icon' => 'grip-solid-horizontal', 'visible' => false), array('text' => Yii::t('link', 'Time report'), 'url' => array('report'), 'visible' => Yii::app()->user->checkAccess($this->id . '/report')), array('text' => Yii::t('link', 'Add a time record'), 'url' => array('create'), 'icon' => 'plus', 'visible' => Yii::app()->user->checkAccess($this->id . '/create'))))); $this->widget('application.components.WContentHeader', array('afterLabel' => false, 'breadcrumbs' => array(array('url' => array($this->action->id), 'active' => true)))); $this->widget('application.components.WPreItemActionBar', array('links' => array(array('dropDown' => array('links' => $allCompany), 'text' => CHtml::encode($companyLinkText), 'options' => array('title' => Yii::t('t', 'Company'))), array('dropDown' => array('links' => $allProject), 'text' => CHtml::encode($projectLinkText), 'options' => array('title' => Yii::t('t', 'Project'))), array('dropDown' => array('links' => $allTask, 'width' => 440), 'text' => CHtml::encode($taskLinkText), 'options' => array('title' => Yii::t('t', 'Task'))), array('dropDown' => array('links' => $allManager), 'text' => CHtml::encode($managerLinkText), 'options' => array('title' => Yii::t('t', 'Manager'))), array('dropDown' => array('links' => $allConsultant), 'text' => CHtml::encode($consultantLinkText), 'options' => array('title' => Yii::t('t', 'Consultant')))))); $this->widget('application.components.WGrid', array('columns' => array(array('title' => CHtml::encode($sort->resolveLabel('company'))), array('title' => CHtml::encode($sort->resolveLabel('project'))), array('title' => CHtml::encode($sort->resolveLabel('task'))), array('title' => CHtml::encode($sort->resolveLabel('manager'))), array('title' => CHtml::encode($sort->resolveLabel('consultant'))), array('title' => CHtml::encode($sort->resolveLabel('timeDate'))), array('title' => CHtml::encode($sort->resolveLabel('spentMinute'))), array('title' => CHtml::encode($sort->resolveLabel('billedMinute'))), array('title' => CHtml::encode($sort->resolveLabel('title'))), array('title' => CHtml::encode(Yii::t('t', 'Actions')))), 'columnsModel' => array(array('name' => 'company', 'width' => 85), array('name' => 'project', 'width' => 85), array('name' => 'task', 'width' => 85), array('name' => 'manager', 'width' => 75), array('name' => 'consultant', 'width' => 75), array('name' => 'timeDate', 'width' => 70, 'align' => 'right'), array('name' => 'spentMinute', 'width' => 35), array('name' => 'billedMinute', 'width' => 35), array('name' => 'title', 'width' => 94), array('name' => 'actions', 'width' => 59, 'sortable' => false)), 'pages' => $pages, 'rowNum' => TimeController::GRID_PAGE_SIZE, 'rows' => $gridRows, 'sColumns' => array(array('title' => $sort->link('company')), array('title' => $sort->link('project')), array('title' => $sort->link('task')), array('title' => $sort->link('manager')), array('title' => $sort->link('consultant')), array('title' => $sort->link('timeDate')), array('title' => $sort->link('spentMinute')), array('title' => $sort->link('billedMinute')), array('title' => $sort->link('title')), array('title' => Yii::t('t', 'Actions'))), 'sortname' => 'timeDate', 'sortorder' => 'desc', 'url' => Yii::app()->createUrl($this->id . '/gridData', $_GET)));
<?php MParams::setPageLabel(Yii::t('page', 'List of company payments')); MLinkList::set('sidebar', array('links' => array(array('text' => Yii::t('link', 'View as grid'), 'url' => array('grid'), 'icon' => 'calculator', 'visible' => Yii::app()->user->checkAccess($this->id . '/grid')), array('text' => Yii::t('link', 'Add a company payment'), 'url' => array('create'), 'icon' => 'plus', 'visible' => Yii::app()->user->checkAccess($this->id . '/create'))))); $this->widget('application.components.WContentHeader', array('breadcrumbs' => array(array('url' => array($this->action->id), 'active' => true)))); if ($pages->getPageCount() >= 2) { ?> <div style="padding: .5em 0 .9em 0;"> <?php $this->widget('CLinkPager', array('pages' => $pages)); ?> </div> <?php } ?> <div class="w3-list"> <?php foreach ($models as $n => $model) { ?> <div class="w3-item<?php echo $n ? '' : ' w3-first'; ?> ui-widget-content ui-corner-all"> <?php echo CHtml::encode($model->getAttributeLabel('companyId')); ?> : <?php echo isset($model->company->id) ? CHtml::link(CHtml::encode($model->company->title), array('company/show', 'id' => $model->company->id)) : '';
<?php MParams::setPageLabel(Yii::t('page', 'Edit project')); MUserFlash::setTopError(_CHtml::errorSummary($model)); MLinkList::set('sidebar', array('links' => array(array('text' => Yii::t('link', 'Show project'), 'url' => array('show', 'id' => $model->id), 'icon' => 'zoomin', 'visible' => Yii::app()->user->checkAccess($this->id . '/show')), array('text' => Yii::t('link', 'Add a task'), 'url' => array('task/create', 'projectId' => $model->id), 'icon' => 'plus', 'visible' => Yii::app()->user->checkAccess('task/create')), array('text' => Yii::t('link', 'Add an expense'), 'url' => array('expense/create', 'projectId' => $model->id), 'icon' => 'plus', 'visible' => Yii::app()->user->checkAccess('expense/create')), array('text' => Yii::t('link', 'List of projects'), 'url' => array('list'), 'icon' => 'grip-solid-horizontal', 'visible' => false), array('text' => Yii::t('link', 'Grid of projects'), 'url' => array('grid'), 'icon' => 'calculator', 'visible' => Yii::app()->user->checkAccess($this->id . '/grid')), array('text' => Yii::t('link', 'Create a new project'), 'url' => array('create'), 'icon' => 'plus', 'visible' => Yii::app()->user->checkAccess($this->id . '/create'))))); $this->widget('application.components.WContentHeader', array('breadcrumbs' => array(array('text' => Yii::t('link', 'Projects'), 'url' => array($this->id . '/' . $this->defaultAction), 'active' => false, 'visible' => Yii::app()->user->checkAccess($this->id . '/' . $this->defaultAction)), array('text' => Yii::t('link', '"{title}" project', array('{title}' => $model->title)), 'url' => array('show', 'id' => $model->id), 'active' => false, 'visible' => Yii::app()->user->checkAccess($this->id . '/show')), array('url' => array($this->action->id, 'id' => $model->id), 'active' => true)))); echo $this->renderPartial('_form', array('model' => $model, 'update' => true));
<?php MParams::setPageLabel(Yii::t('page', 'List of time records')); MLinkList::set('sidebar', array('links' => array(array('text' => Yii::t('link', 'View as grid'), 'url' => array('grid'), 'icon' => 'calculator'), array('text' => Yii::t('link', 'Add a time record'), 'url' => array('create'), 'icon' => 'plus')))); $this->widget('application.components.WContentHeader', array('breadcrumbs' => array(array('url' => array($this->action->id), 'active' => true)))); if ($pages->getPageCount() >= 2) { ?> <div style="padding: .5em 0 .9em 0;"> <?php $this->widget('CLinkPager', array('pages' => $pages)); ?> </div> <?php } ?> <div class="w3-list"> <?php foreach ($models as $n => $model) { ?> <div class="w3-item<?php echo $n ? '' : ' w3-first'; ?> ui-widget-content ui-corner-all"> <?php echo CHtml::encode($model->getAttributeLabel('id')); ?> : <?php echo CHtml::link($model->id, array('show', 'id' => $model->id));
<?php MParams::setPageLabel(Yii::t('page', 'Edit company')); MUserFlash::setTopError(_CHtml::errorSummary($model)); MLinkList::set('sidebar', array('links' => array(array('text' => Yii::t('link', 'Show company'), 'url' => array('show', 'id' => $model->id), 'icon' => 'zoomin', 'visible' => Yii::app()->user->checkAccess($this->id . '/show')), array('text' => Yii::t('link', 'Add a project'), 'url' => array('project/create', 'companyId' => $model->id), 'icon' => 'plus', 'visible' => Yii::app()->user->checkAccess('project/create')), array('text' => Yii::t('link', 'Add a company payment'), 'url' => array('companyPayment/create', 'companyId' => $model->id), 'icon' => 'plus', 'visible' => Yii::app()->user->checkAccess('companyPayment/create')), array('text' => Yii::t('link', 'Add an invoice'), 'url' => array('invoice/create', 'companyId' => $model->id), 'icon' => 'plus', 'visible' => Yii::app()->user->checkAccess('invoice/create')), array('text' => Yii::t('link', 'List of companies'), 'url' => array('list'), 'icon' => 'grip-solid-horizontal', 'visible' => false), array('text' => Yii::t('link', 'Grid of companies'), 'url' => array('grid'), 'icon' => 'calculator', 'visible' => Yii::app()->user->checkAccess($this->id . '/grid')), array('text' => Yii::t('link', 'Create a new company'), 'url' => array('create'), 'icon' => 'plus', 'visible' => Yii::app()->user->checkAccess($this->id . '/create'))))); $this->widget('application.components.WContentHeader', array('breadcrumbs' => array(array('text' => Yii::t('link', 'Companies'), 'url' => array($this->id . '/' . $this->defaultAction), 'active' => false, 'visible' => Yii::app()->user->checkAccess($this->id . '/' . $this->defaultAction)), array('text' => Yii::t('link', '"{title}" company', array('{title}' => $model->title)), 'url' => array('show', 'id' => $model->id), 'active' => false, 'visible' => Yii::app()->user->checkAccess($this->id . '/show')), array('url' => CHtml::normalizeUrl(array($this->action->id, 'id' => $model->id)), 'active' => true)))); echo $this->renderPartial('_form', array('model' => $model, 'update' => true));
<?php MParams::setPageLabel(Yii::t('page', 'Grid of companies')); MUserFlash::setSidebarInfo(Yii::t('hint', 'Required: {authRoles}.', array(3, '{authRoles}' => implode(', ', array(Yii::t('t', User::CLIENT_T), Yii::t('t', User::MANAGER_T), Yii::t('t', User::ADMINISTRATOR_T)))))); MLinkList::set('sidebar', array('links' => array(array('text' => Yii::t('link', 'View as list'), 'url' => array('list'), 'icon' => 'grip-solid-horizontal', 'visible' => false), array('text' => Yii::t('link', 'Add a company'), 'url' => array('create'), 'icon' => 'plus')))); $this->widget('application.components.WContentHeader', array('afterLabel' => false, 'breadcrumbs' => array(array('url' => array($this->action->id), 'active' => true)))); $this->widget('application.components.WPreItemActionBar', array('links' => array(array('dropDown' => array('links' => $allState), 'text' => CHtml::encode($stateLinkText), 'options' => array('title' => Yii::t('t', 'State[company]')))))); $this->widget('application.components.WGrid', array('columns' => array(array('title' => CHtml::encode($sort->resolveLabel('title'))), array('title' => CHtml::encode($sort->resolveLabel('titleAbbr'))), array('title' => CHtml::encode($sort->resolveLabel('contactName'))), array('title' => CHtml::encode($sort->resolveLabel('createTime'))), array('title' => CHtml::encode($sort->resolveLabel('deactivationTime'))), array('title' => CHtml::encode(Yii::t('t', 'Actions')))), 'columnsModel' => array(array('name' => 'title', 'width' => 290), array('name' => 'titleAbbr', 'width' => 50), array('name' => 'contactName', 'width' => 150), array('name' => 'createTime', 'width' => 75, 'align' => 'right'), array('name' => 'deactivationTime', 'width' => 74, 'align' => 'right'), array('name' => 'actions', 'width' => 59, 'sortable' => false)), 'pages' => $pages, 'rowNum' => CompanyController::GRID_PAGE_SIZE, 'rows' => $gridRows, 'sColumns' => array(array('title' => $sort->link('title')), array('title' => $sort->link('titleAbbr')), array('title' => $sort->link('contactName')), array('title' => $sort->link('createTime')), array('title' => $sort->link('deactivationTime')), array('title' => Yii::t('t', 'Actions'))), 'sortname' => 'deactivationTime', 'sortorder' => 'asc', 'url' => Yii::app()->createUrl($this->id . '/gridData', $_GET)));