Exemplo n.º 1
0
    $logoSize = @getimagesize(Yii::app()->params->logo);
    if($logoSize)
        $logoSize = array(min($logoSize[0], 200), min($logoSize[1], 30));
    else
        $logoSize = array(92, 30);

    $logoOptions['width'] = $logoSize[0];
    $logoOptions['height'] = $logoSize[1];
}*/
/* Construction of the user menu */
$notifCount = X2Model::model('Notification')->countByAttributes(array('user' => Yii::app()->user->getName()), 'createDate < ' . time());
$searchbarHtml = CHtml::beginForm(array('/search/search'), 'get') . '<button class="x2-button black" type="submit"><span></span></button>' . CHtml::textField('term', Yii::t('app', 'Search for contact, action, deal...'), array('id' => 'search-bar-box', 'onfocus' => 'x2.forms.toggleTextResponsive(this);', 'onblur' => 'x2.forms.toggleTextResponsive(this);', 'data-short-default-text' => Yii::t('app', 'Search'), 'data-long-default-text' => Yii::t('app', 'Search for contact, action, deal...'), 'autocomplete' => 'off')) . '</form>';
if (!empty($profile->avatar) && file_exists($profile->avatar)) {
    $avatar = Profile::renderAvatarImage($profile->id, 25, 25);
} else {
    $avatar = X2Html::defaultAvatar(25);
}
$widgetsImageUrl = $themeUrl . '/images/admin_settings.png';
if (!Yii::app()->user->isGuest) {
    $widgetMenu = $profile->getWidgetMenu();
} else {
    $widgetMenu = "";
}
$userMenu = array(array('label' => Yii::t('app', 'Admin'), 'url' => array('/admin/index'), 'active' => $module == 'admin' ? true : null, 'visible' => $isAdmin, 'itemOptions' => array('id' => 'admin-user-menu-link', 'class' => 'user-menu-link ' . ($isAdmin ? 'x2-first' : ''))), array('label' => Yii::t('app', 'Profile'), 'url' => array('/profile/view', 'id' => Yii::app()->user->getId()), 'itemOptions' => array('id' => 'profile-user-menu-link', 'class' => 'user-menu-link ' . ($isAdmin ? '' : 'x2-first'))), array('label' => Yii::t('app', 'Users'), 'url' => array('/users/users/admin'), 'visible' => $isAdmin, 'itemOptions' => array('id' => 'admin-users-user-menu-link', 'class' => 'user-menu-link')), array('label' => Yii::t('app', 'Users'), 'url' => array('/profile/profiles'), 'visible' => !$isAdmin, 'itemOptions' => array('id' => 'non-admin-users-user-menu-link', 'class' => 'user-menu-link')), array('label' => $searchbarHtml, 'itemOptions' => array('id' => 'search-bar', 'class' => 'special')));
$userMenuItems = array(array('label' => Yii::t('app', 'Profile'), 'url' => array('/profile/view', 'id' => Yii::app()->user->getId())), array('label' => Yii::t('app', 'Notifications'), 'url' => array('/site/viewNotifications')), array('label' => Yii::t('app', 'Preferences'), 'url' => array('/profile/settings')), array('label' => Yii::t('profile', 'Manage Apps'), 'url' => array('/profile/manageCredentials')), array('label' => Yii::t('help', 'Icon Reference'), 'url' => array('/site/page', 'view' => 'iconreference')), array('label' => Yii::t('help', 'Help'), 'url' => 'http://www.x2crm.com/reference_guide', 'linkOptions' => array('target' => '_blank')), array('label' => Yii::t('app', 'Report A Bug'), 'url' => array('/site/bugReport')), array('label' => Yii::t('app', '---'), 'itemOptions' => array('class' => 'divider')), array('label' => Yii::app()->params->sessionStatus ? Yii::t('app', 'Go Invisible') : Yii::t('app', 'Go Visible'), 'url' => '#', 'linkOptions' => array('submit' => array('/site/toggleVisibility', 'visible' => !Yii::app()->params->sessionStatus, 'redirect' => Yii::app()->request->requestUri), 'csrf' => true, 'confirm' => 'Are you sure you want to toggle your session status?')), array('label' => Yii::t('app', 'Logout'), 'url' => array('/site/logout')));
if (!$isGuest) {
    $userMenu2 = array(array('label' => CHtml::link('<span>' . $notifCount . '</span>', '#', array('id' => 'main-menu-notif', 'style' => 'z-index:999;')), 'itemOptions' => array('class' => 'special')), array('label' => CHtml::link('<i class="fa fa-lg fa-toggle-right"></i>', '#', array('class' => 'x2-button', 'id' => 'fullscreen-button', 'title' => Yii::t('app', 'toggle widgets'))), 'itemOptions' => array('class' => 'search-bar special')), array('label' => CHtml::link('<div class="widget-icon"><i class="fa fa-lg fa-cog"></i></div>', '#', array('id' => 'widget-button', 'class' => 'x2-button', 'title' => 'hidden widgets')) . $widgetMenu, 'itemOptions' => array('class' => 'search-bar special')), array('label' => $avatar . Yii::app()->suModel->alias, 'itemOptions' => array('id' => 'profile-dropdown', 'class' => 'dropdown'), 'items' => $userMenuItems));
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php