コード例 #1
1
 /**
  * Displays the login page
  * @param object $formModel
  * @param bool $isMobile Whether this was called from mobile site controller
  */
 public function login(LoginForm $model, $isMobile = false)
 {
     $model->attributes = $_POST['LoginForm'];
     // get user input data
     Session::cleanUpSessions();
     $ip = $this->owner->getRealIp();
     $userModel = $model->getUser();
     $isRealUser = $userModel instanceof User;
     $effectiveUsername = $isRealUser ? $userModel->username : $model->username;
     $isActiveUser = $isRealUser && $userModel->status == User::STATUS_ACTIVE;
     /* increment count on every session with this user/IP, to prevent brute force attacks 
        using session_id spoofing or whatever */
     Yii::app()->db->createCommand('UPDATE x2_sessions SET status=status-1,lastUpdated=:time WHERE user=:name AND 
         CAST(IP AS CHAR)=:ip AND status BETWEEN -2 AND 0')->bindValues(array(':time' => time(), ':name' => $effectiveUsername, ':ip' => $ip))->execute();
     $activeUser = Yii::app()->db->createCommand()->select('username')->from('x2_users')->where('username=:name AND status=1', array(':name' => $model->username))->limit(1)->queryScalar();
     // get the correctly capitalized username
     if (isset($_SESSION['sessionId'])) {
         $sessionId = $_SESSION['sessionId'];
     } else {
         $sessionId = $_SESSION['sessionId'] = session_id();
     }
     $session = X2Model::model('Session')->findByPk($sessionId);
     /* get the number of failed login attempts from this IP within timeout interval. If the 
        number of login attempts exceeds maximum, display captcha */
     $badAttemptsRefreshTimeout = 900;
     $maxFailedLoginAttemptsPerIP = 100;
     $maxLoginsBeforeCaptcha = 5;
     $this->pruneTimedOutBans($badAttemptsRefreshTimeout);
     $failedLoginRecord = FailedLogins::model()->findActiveByIp($ip);
     $badAttemptsWithThisIp = $failedLoginRecord ? $failedLoginRecord->attempts : 0;
     if ($badAttemptsWithThisIp >= $maxFailedLoginAttemptsPerIP) {
         $this->recordFailedLogin($ip);
         throw new CHttpException(403, Yii::t('app', 'You are not authorized to use this application'));
     }
     // if this client has already tried to log in, increment their attempt count
     if ($session === null) {
         $session = new Session();
         $session->id = $sessionId;
         $session->user = $model->getSessionUserName();
         $session->lastUpdated = time();
         $session->status = 0;
         $session->IP = $ip;
     } else {
         $session->lastUpdated = time();
         $session->user = $model->getSessionUserName();
     }
     if ($isActiveUser === false) {
         $model->verifyCode = '';
         // clear captcha code
         $model->validate();
         // validate captcha if it's being used
         $this->recordFailedLogin($ip);
         $session->save();
         if ($badAttemptsWithThisIp + 1 >= $maxFailedLoginAttemptsPerIP) {
             throw new CHttpException(403, Yii::t('app', 'You are not authorized to use this application'));
         } else {
             if ($badAttemptsWithThisIp >= $maxLoginsBeforeCaptcha - 1) {
                 $model->useCaptcha = true;
                 $model->setScenario('loginWithCaptcha');
                 $session->status = -2;
             }
         }
     } else {
         if ($model->validate() && $model->login()) {
             // user successfully logged in
             if ($model->rememberMe) {
                 foreach (array('username', 'rememberMe') as $attr) {
                     // Expires in 30 days
                     AuxLib::setCookie(CHtml::resolveName($model, $attr), $model->{$attr}, 2592000);
                 }
             } else {
                 foreach (array('username', 'rememberMe') as $attr) {
                     // Remove the cookie if they unchecked the box
                     AuxLib::clearCookie(CHtml::resolveName($model, $attr));
                 }
             }
             // We're not using the isAdmin parameter of the application
             // here because isAdmin in this context hasn't been set yet.
             $isAdmin = Yii::app()->user->checkAccess('AdminIndex');
             if ($isAdmin && !$isMobile) {
                 $this->owner->attachBehavior('updaterBehavior', new UpdaterBehavior());
                 $this->owner->checkUpdates();
                 // check for updates if admin
             } else {
                 Yii::app()->session['versionCheck'] = true;
             }
             // ...or don't
             $session->status = 1;
             $session->save();
             SessionLog::logSession($model->username, $sessionId, 'login');
             $_SESSION['playLoginSound'] = true;
             if (YII_UNIT_TESTING && defined('X2_DEBUG_EMAIL') && X2_DEBUG_EMAIL) {
                 Yii::app()->session['debugEmailWarning'] = 1;
             }
             // if ( isset($_POST['themeName']) ) {
             //     $profile = X2Model::model('Profile')->findByPk(Yii::app()->user->id);
             //     $profile->theme = array_merge(
             //         $profile->theme,
             //         ThemeGenerator::loadDefault( $_POST['themeName'])
             //     );
             //     $profile->save();
             // }
             LoginThemeHelper::login();
             if ($isMobile) {
                 $this->owner->redirect($this->owner->createUrl('/mobile/home'));
             } else {
                 if (Yii::app()->user->returnUrl == '/site/index') {
                     $this->owner->redirect(array('/site/index'));
                 } else {
                     // after login, redirect to wherever
                     $this->owner->redirect(Yii::app()->user->returnUrl);
                 }
             }
         } else {
             // login failed
             $model->verifyCode = '';
             // clear captcha code
             $this->recordFailedLogin($ip);
             $session->save();
             if ($badAttemptsWithThisIp + 1 >= $maxFailedLoginAttemptsPerIP) {
                 throw new CHttpException(403, Yii::t('app', 'You are not authorized to use this application'));
             } else {
                 if ($badAttemptsWithThisIp >= $maxLoginsBeforeCaptcha - 1) {
                     $model->useCaptcha = true;
                     $model->setScenario('loginWithCaptcha');
                     $session->status = -2;
                 }
             }
         }
     }
     $model->rememberMe = false;
 }
コード例 #2
0
ファイル: MobileActiveForm.php プロジェクト: tymiles003/X2CRM
 public function init()
 {
     if (!$this->action && Yii::app()->params->isPhoneGap) {
         $this->action = AuxLib::getRequestUrl();
     }
     return parent::init();
 }
コード例 #3
0
ファイル: FileUploadsFilter.php プロジェクト: keyeMyria/CRM
 /**
  * Returns true if the file is safe to upload.
  *
  * Will use fileinfo if available for determining mime type of the uploaded file.
  * @param array $file
  */
 public function checkFilename($filename)
 {
     if (preg_match(self::EXT_BLACKLIST, $filename, $match)) {
         AuxLib::debugLog('Throwing exception for array: ' . var_export($_FILES, 1));
         throw new CHttpException(403, Yii::t('app', 'Forbidden file type: {ext}', array('{ext}' => $match['ext'])));
     }
 }
コード例 #4
0
ファイル: MassAddToListTest.php プロジェクト: keyeMyria/CRM
 /**
  * Create new list from selection then mass add to newly created list
  */
 public function testExecute()
 {
     TestingAuxLib::suLogin('admin');
     X2List::model()->deleteAllByAttributes(array('name' => 'test'));
     $newList = new NewListFromSelection();
     $addToList = new MassAddToList();
     // create new list with 2 records
     $_POST['modelType'] = 'Contacts';
     $_POST['listName'] = 'test';
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $_SERVER['SERVER_NAME'] = 'localhost';
     Yii::app()->controller = new ContactsController('contacts', new ContactsModule('contacts', null));
     $gvSelection = range(1, 2);
     AuxLib::debugLogR($newList->execute($gvSelection));
     $getFlashes = TestingAuxLib::setPublic('NewListFromSelection', 'getFlashes');
     AuxLib::debugLogR($getFlashes());
     $list = X2List::model()->findByAttributes(array('name' => 'test'));
     $itemIds = $list->queryCommand(true)->select('id')->queryColumn();
     $this->assertEquals(array(1, 2), $itemIds);
     //  add the rest of the contacts to the newly created list
     unset($_POST['modelType']);
     unset($_POST['listName']);
     $_POST['listId'] = $list->id;
     $gvSelection = range(3, 24);
     $addToList->execute($gvSelection);
     $itemIds = $list->queryCommand(true)->select('id')->queryColumn();
     $this->assertEquals(range(1, 24), $itemIds);
 }
コード例 #5
0
ファイル: MarketingController.php プロジェクト: shayanyi/CRM
 /**
  * Deletes a web form record with the specified id 
  * @param int $id
  */
 public function actionDeleteWebForm($id)
 {
     $model = WebForm::model()->findByPk($id);
     $name = $model->name;
     $success = false;
     if ($model) {
         $success = $model->delete();
     }
     AuxLib::ajaxReturn($success, Yii::t('app', "Deleted '{$name}'"), Yii::t('app', 'Unable to delete web form'));
 }
コード例 #6
0
ファイル: ResponsiveHtml.php プロジェクト: dsyman2/X2CRM
 public static function gripButton($htmlOptions = array())
 {
     if (AuxLib::getLayoutType() !== 'responsive') {
         return '';
     }
     if (!isset($htmlOptions['class'])) {
         $htmlOptions['class'] = 'mobile-dropdown-button';
     }
     return self::tag('div', $htmlOptions, '<div class="x2-bar"></div>
          <div class="x2-bar"></div>
          <div class="x2-bar"></div>');
 }
コード例 #7
0
ファイル: ChartsModule.php プロジェクト: keyeMyria/CRM
 public function init()
 {
     // this method is called when the module is being created
     // you may place code here to customize the module or the application
     // import the module-level models and components
     $this->setImport(array('charts.models.*', 'charts.components.*'));
     // Set module specific javascript packages
     $this->packages = array('jquery' => array('basePath' => $this->getBasePath(), 'baseUrl' => $this->assetsUrl, 'js' => array('js/jquery.js')), 'jquerysparkline' => array('basePath' => $this->getBasePath(), 'baseUrl' => $this->assetsUrl, 'css' => array('css/charts.css'), 'js' => array('js/splunk/jquery.sparkline.js'), 'depends' => array('jquery')), 'jqplot' => array('basePath' => $this->getBasePath(), 'baseUrl' => $this->assetsUrl, 'css' => array('js/jqplot/jquery.jqplot.css', 'css/charts.css'), 'js' => array('js/jqplot/jquery.jqplot.js'), 'depends' => array('jquery')), 'jqlineplot' => array('basePath' => $this->getBasePath(), 'baseUrl' => $this->assetsUrl, 'js' => array('js/jqplot/plugins/jqplot.canvasTextRenderer.js', 'js/jqplot/plugins/jqplot.categoryAxisRenderer.js', 'js/jqplot/plugins/jqplot.canvasAxisLabelRenderer.js'), 'depends' => array('jqplot')), 'jqpieplot' => array('basePath' => $this->getBasePath(), 'baseUrl' => $this->assetsUrl, 'js' => array('js/jqplot/plugins/jqplot.pieRenderer.js'), 'depends' => array('jqplot')), 'jqbubbleplot' => array('basePath' => $this->getBasePath(), 'baseUrl' => $this->assetsUrl, 'js' => array('js/jqplot/plugins/jqplot.bubbleRenderer.js'), 'depends' => array('jqplot')), 'jqfunnelplot' => array('basePath' => $this->getBasePath(), 'baseUrl' => $this->assetsUrl, 'js' => array('js/jqplot/plugins/jqplot.funnelRenderer.js'), 'depends' => array('jqplot')), 'jqbarplot' => array('basePath' => $this->getBasePath(), 'baseUrl' => $this->assetsUrl, 'js' => array('js/jqplot/plugins/jqplot.barRenderer.js', 'js/jqplot/plugins/jqplot.canvasTextRenderer.js', 'js/jqplot/plugins/jqplot.categoryAxisRenderer.js', 'js/jqplot/plugins/jqplot.canvasAxisTickRenderer.js', 'js/jqplot/plugins/jqplot.dateAxisRenderer.js', 'js/jqplot/plugins/jqplot.pointLabels.js'), 'depends' => array('jqplot')));
     if (AuxLib::isIE8()) {
         $this->packages['jqplot']['js'][] = 'js/jqplot/excanvas.js';
     }
     Yii::app()->clientScript->packages = $this->packages;
     // set module layout
     // $this->layout = 'main';
 }
コード例 #8
0
ファイル: TagCloud.php プロジェクト: tymiles003/X2CRM
 public function run()
 {
     $hiddenTags = json_decode(Yii::app()->params->profile->hiddenTags, true);
     $params = array();
     if (count($hiddenTags) > 0) {
         $tagParams = AuxLib::bindArray($hiddenTags);
         $params = array_merge($params, $tagParams);
         $str1 = " AND tag NOT IN (" . implode(',', array_keys($tagParams)) . ")";
     } else {
         $str1 = "";
     }
     $myTags = Yii::app()->db->createCommand()->select('COUNT(*) AS count, tag')->from('x2_tags')->where('taggedBy=:user AND tag IS NOT NULL' . $str1, array_merge($params, array(':user' => Yii::app()->user->getName())))->group('tag')->order('count DESC')->limit(20)->queryAll();
     $allTags = Yii::app()->db->createCommand()->select('COUNT(*) AS count, tag')->from('x2_tags')->group('tag')->where('tag IS NOT NULL' . $str1, $params)->order('count DESC')->limit(20)->queryAll();
     // $myTags=Tags::model()->findAllBySql("SELECT *, COUNT(*) as num FROM x2_tags WHERE taggedBy='".Yii::app()->user->getName()."' GROUP BY tag ORDER BY num DESC LIMIT 20");
     // $allTags=Tags::model()->findAllBySql("SELECT *, COUNT(*) as num FROM x2_tags GROUP BY tag ORDER BY num DESC LIMIT 20");
     $this->render('tagCloud', array('myTags' => $myTags, 'allTags' => $allTags, 'showAllUsers' => Yii::app()->params->profile->tagsShowAllUsers));
 }
コード例 #9
0
ファイル: activity.php プロジェクト: dsyman2/X2CRM
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with
 * this program; if not, see http://www.gnu.org/licenses or write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301 USA.
 * 
 * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 * California 95067, USA. or at email address contact@x2engine.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * X2Engine" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2Engine".
 *****************************************************************************************/
/*
Public/private profile page. If the requested profile belongs to the current user, profile widgets
get displayed in addition to the activity feed/profile information sections. 
*/
Yii::app()->clientScript->registerCssFiles('profileCombinedCss', array('profile.css', 'activityFeed.css', '../../../js/multiselect/css/ui.multiselect.css'));
Yii::app()->clientScript->registerResponsiveCssFile(Yii::app()->getTheme()->getBaseUrl() . '/css/responsiveActivityFeed.css');
AuxLib::registerPassVarsToClientScriptScript('x2.profile', array('isMyProfile' => $isMyProfile ? 'true' : 'false'), 'profileScript');
$this->renderPartial('_activityFeed', array('dataProvider' => $dataProvider, 'profileId' => $model->id, 'users' => $users, 'lastEventId' => $lastEventId, 'firstEventId' => $firstEventId, 'lastTimestamp' => $lastTimestamp, 'stickyDataProvider' => $stickyDataProvider, 'userModels' => $userModels, 'isMyProfile' => $isMyProfile));
コード例 #10
0
ファイル: index.php プロジェクト: tymiles003/X2CRM
        e.preventDefault();
        $(".items").animate({ scrollTop: 0 }, "slow");
    });*/
    $(document).on('click','#advanced-controls-toggle',function(e){
        e.preventDefault();
        if($('#advanced-controls').is(':hidden')){
            $("#advanced-controls").slideDown();
        }else{
            $("#advanced-controls").slideUp();
        }
    });
    $(document).on('ready',function(){
        $('#advanced-controls').after('<div class="form" id="action-view-pane" style="float:right;width:0px;display:none;padding:0px;"></div>');
    });
    <?php 
if (AuxLib::isIPad()) {
    echo "\$(document).on('vclick', '.view', function (e) {";
} else {
    echo "\$(document).on('click','.view',function(e){";
}
?>
        if(!$(e.target).is('a')){
            e.preventDefault();
            if(clickedFlag){
                if($('#action-view-pane').hasClass($(this).attr('id'))){
                    $('#action-view-pane').removeClass($(this).attr('id'));
                    $('.items').animate({'margin-right': '20px'},400,function(){
                        $('.items').css('margin-right','0px')
                    });
                    $('#action-view-pane').html('<div style="height:800px;"></div>');
                    $('#action-view-pane').animate({width: '0px'},400,function(){
コード例 #11
0
ファイル: X2GridViewBase.php プロジェクト: dsyman2/X2CRM
 public function renderSummary()
 {
     if (AuxLib::getLayoutType() === 'responsive' && $this->enableResponsiveTitleBar) {
         Yii::app()->clientScript->registerCss('mobileDropdownCss', "\n            .grid-view .mobile-dropdown-button {\n                float: right;\n                display: block;\n                margin-top: -24px;\n                margin-right: 8px;\n            }\n        ");
         $afterUpdateJSString = "\n            ;(function () {\n            var grid = \$('#" . $this->id . "');\n            \$('#" . $this->namespacePrefix . "-mobile-dropdown').unbind ('click.mobileDropdownScript')\n                .bind ('click.mobileDropdownScript', function () {\n                    if (grid.hasClass ('show-top-buttons')) {\n                        grid.find ('.page-title').css ({ height: '' });\n                        grid.removeClass ('show-top-buttons');\n                    } else {\n                        grid.find ('.page-title').animate ({ height: '68px' }, 300);\n                        grid.addClass ('show-top-buttons');\n                        \$(window).one ('resize', function () {\n                            grid.find ('.page-title').css ({ height: '' });\n                            grid.removeClass ('show-top-buttons');\n                        });\n                    }\n                });\n            }) ();\n        ";
         $this->addToAfterAjaxUpdate($afterUpdateJSString);
         echo '<div id="' . $this->namespacePrefix . '-mobile-dropdown" class="mobile-dropdown-button">
             <div class="x2-bar"></div>
             <div class="x2-bar"></div>
             <div class="x2-bar"></div>
         </div>';
     }
     parent::renderSummary();
 }
コード例 #12
0
ファイル: X2Model.php プロジェクト: tymiles003/X2CRM
 /**
  * Getter for {@link fieldPermissions}
  * @return type
  */
 public function getFieldPermissions()
 {
     $class = get_class($this);
     if (!isset(self::$_fieldPermissions[$class])) {
         $roles = Roles::getUserRoles(Yii::app()->getSuId());
         if (!$this->isExemptFromFieldLevelPermissions) {
             $permRecords = Yii::app()->db->createCommand()->select("f.fieldName,MAX(rtp.permission),f.readOnly")->from(RoleToPermission::model()->tableName() . ' rtp')->join(Fields::model()->tableName() . ' f', 'rtp.fieldId=f.id ' . 'AND rtp.roleId IN ' . AuxLib::arrToStrList($roles) . ' ' . 'AND f.modelName=:class', array(':class' => $class))->group('f.fieldName')->queryAll(false);
         } else {
             $permRecords = Yii::app()->db->createCommand()->select("fieldName,CAST(2 AS UNSIGNED INTEGER),readOnly")->from(Fields::model()->tableName() . ' f')->where('modelName=:class', array(':class' => $class))->queryAll(false);
         }
         $fieldPerms = array();
         foreach ($permRecords as $record) {
             // If the permissions of the user on the field are "2" (write),
             // subtract the readOnly field
             $fieldPerms[$record[0]] = $record[1] - (int) ((int) $record[1] === 2 ? $record[2] : 0);
         }
         self::$_fieldPermissions[$class] = $fieldPerms;
     }
     return self::$_fieldPermissions[$class];
 }
コード例 #13
0
ファイル: Groups.php プロジェクト: dsyman2/X2CRM
 /**
  * Gets a list of names of all users having a group in common with a user.
  *
  * @param integer $userId User's ID
  * @param boolean $cache Whether to cache or not
  * @return array 
  */
 public static function getGroupmates($userId, $cache = true)
 {
     if ($cache === true && ($groupmates = Yii::app()->cache->get('user_groupmates')) !== false) {
         if (isset($groupmates[$userId])) {
             return $groupmates[$userId];
         }
     } else {
         $groupmates = array();
     }
     $userGroups = self::getUserGroups($userId, $cache);
     $groupmates[$userId] = array();
     if (!empty($userGroups)) {
         $groupParam = AuxLib::bindArray($userGroups, 'gid_');
         $inGroup = AuxLib::arrToStrList(array_keys($groupParam));
         $groupmates[$userId] = Yii::app()->db->createCommand()->select('DISTINCT(gtu.username)')->from(GroupToUser::model()->tableName() . ' gtu')->join(User::model()->tableName() . ' u', 'gtu.userId=u.id AND gtu.groupId IN ' . $inGroup, $groupParam)->queryColumn();
     }
     if ($cache === true) {
         Yii::app()->cache->set('user_groupmates', $groupmates, 259200);
     }
     return $groupmates[$userId];
 }
コード例 #14
0
ファイル: X2LinkableBehavior.php プロジェクト: keyeMyria/CRM
 /**
  * Improved version of getItems which enables use of empty search string, pagination, and
  * configurable option values/names.
  * @param string $prefix name prefix of items to retrieve
  * @param int $page page number of results to retrieve
  * @param int $limit max number of results to retrieve
  * @param string|array $valueAttr attribute(s) used to popuplate the option values. If an 
  *  array is passed, value will composed of values of each of the attributes specified, joined
  *  by commas
  * @param string $nameAttr attribute used to popuplate the option names
  * @return array name, value pairs
  */
 public function getItems2($prefix = '', $page = 0, $limit = 20, $valueAttr = 'name', $nameAttr = 'name')
 {
     $modelClass = get_class($this->owner);
     $model = CActiveRecord::model($modelClass);
     $table = $model->tableName();
     $offset = intval($page) * intval($limit);
     AuxLib::coerceToArray($valueAttr);
     $modelClass::checkThrowAttrError(array_merge($valueAttr, array($nameAttr)));
     $params = array();
     if ($prefix !== '') {
         $params[':prefix'] = $prefix . '%';
     }
     $offset = abs((int) $offset);
     $limit = abs((int) $limit);
     $command = Yii::app()->db->createCommand("\n            SELECT " . implode(',', $valueAttr) . ", {$nameAttr} as __name\n            FROM {$table}\n            WHERE " . ($prefix === '' ? '1=1' : $nameAttr . ' LIKE :prefix') . "\n            ORDER BY __name\n            LIMIT {$offset}, {$limit}\n        ");
     $rows = $command->queryAll(true, $params);
     $items = array();
     foreach ($rows as $row) {
         $name = $row['__name'];
         unset($row['__name']);
         $items[] = array($name, $row);
     }
     return $items;
 }
コード例 #15
0
ファイル: _form.php プロジェクト: tymiles003/X2CRM
 $attributes = array();
 if ($model->type === 'email') {
     foreach (X2Model::model('Contacts')->getAttributeLabels() as $fieldName => $label) {
         $attributes[$label] = '{' . $fieldName . '}';
     }
 } else {
     $accountAttributes = array();
     $contactAttributes = array();
     $quoteAttributes = array();
     foreach (Contacts::model()->getAttributeLabels() as $fieldName => $label) {
         AuxLib::debugLog('Iterating over contact attributes ' . $fieldName . '=>' . $label);
         $index = Yii::t('contacts', "{contact}", array('{contact}' => $modTitles['contact'])) . ": {$label}";
         $contactAttributes[$index] = "{associatedContacts.{$fieldName}}";
     }
     foreach (Accounts::model()->getAttributeLabels() as $fieldName => $label) {
         AuxLib::debugLog('Iterating over account attributes ' . $fieldName . '=>' . $label);
         $index = Yii::t('accounts', "{account}", array('{account}' => $modTitles['account'])) . ": {$label}";
         $accountAttributes[$index] = "{accountName.{$fieldName}}";
     }
     $Quote = Yii::t('quotes', "{quote}: ", array('{quote}' => $modTitles['quote']));
     $quoteAttributes[$Quote . Yii::t('quotes', "Item Table")] = '{lineItems}';
     $quoteAttributes[$Quote . Yii::t('quotes', "Date printed/emailed")] = '{dateNow}';
     $quoteAttributes[$Quote . Yii::t('quotes', '{quote} or Invoice', array('{quote}' => $modTitles['quote']))] = '{quoteOrInvoice}';
     foreach (Quote::model()->getAttributeLabels() as $fieldName => $label) {
         $index = $Quote . "{$label}";
         $quoteAttributes[$index] = "{" . $fieldName . "}";
     }
 }
 if ($model->type === 'email') {
     $js = 'x2.insertableAttributes = ' . CJSON::encode(array(Yii::t('contacts', '{contact} Attributes', array('{contact}' => $modTitles['contact'])) => $attributes)) . ';';
 } else {
コード例 #16
0
ファイル: _inlineFunnel.php プロジェクト: tymiles003/X2CRM
 * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 * California 95067, USA. or at email address contact@x2engine.com.
 * 
 * The interactive user interfaces in modified source and object code versions
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * X2Engine" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2Engine".
 *****************************************************************************************/
/**
 * Used by inline workflow widget to render the funnel 
 */
if (AuxLib::isIE8()) {
    Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/jqplot/excanvas.js');
}
if ($this->id !== 'Workflow') {
    $assetsUrl = Yii::app()->assetManager->publish(Yii::getPathOfAlias('application.modules.workflow.assets'), false, -1, YII_DEBUG ? true : null);
} else {
    $assetsUrl = $this->module->assetsUrl;
}
Yii::app()->clientScript->registerScriptFile($assetsUrl . '/js/X2Geometry.js', CClientScript::POS_END);
Yii::app()->clientScript->registerScriptFile($assetsUrl . '/js/BaseFunnel.js', CClientScript::POS_END);
Yii::app()->clientScript->registerScriptFile($assetsUrl . '/js/InlineFunnel.js', CClientScript::POS_END);
Yii::app()->clientScript->registerScript('_funnelJS', "\n\nx2.inlineFunnel = new x2.InlineFunnel ({\n    workflowStatus: " . CJSON::encode($workflowStatus) . ",\n    translations: " . CJSON::encode(array('Completed' => Yii::t('workflow', 'Completed'), 'Started' => Yii::t('workflow', 'Started'), 'Details' => Yii::t('workflow', 'Details'), 'Revert Stage' => Yii::t('workflow', 'Revert Stage'), 'Complete Stage' => Yii::t('workflow', 'Complete Stage'), 'Start' => Yii::t('workflow', 'Start'), 'noRevertPermissions' => Yii::t('workflow', 'You do not have permission to revert this stage.'), 'noCompletePermissions' => Yii::t('workflow', 'You do not have permission to complete this stage.'))) . ",\n    stageCount: " . $stageCount . ",\n    containerSelector: '#funnel-container',\n    colors: " . CJSON::encode($colors) . ",\n    revertButtonUrl: '" . Yii::app()->theme->getBaseUrl() . "/images/icons/Uncomplete.png',\n    completeButtonUrl: '" . Yii::app()->theme->getBaseUrl() . "/images/icons/Complete.png',\n    stageNames: " . CJSON::encode(Workflow::getStageNames($workflowStatus)) . ",\n    stagePermissions: " . CJSON::encode(Workflow::getStagePermissions($workflowStatus)) . ",\n    uncompletionPermissions: " . CJSON::encode(Workflow::getStageUncompletionPermissions($workflowStatus)) . ",\n    stagesWhichRequireComments: " . CJSON::encode(Workflow::getStageCommentRequirements($workflowStatus)) . "\n});\n\n", CClientScript::POS_END);
?>
<div id='funnel-container'></div>
コード例 #17
0
ファイル: FieldFormatterTest.php プロジェクト: keyeMyria/CRM
 /**
  * Clean up custom field columns 
  */
 public static function tearDownAfterClass()
 {
     $fields = Fields::model()->findAllByAttributes(array('custom' => 1));
     foreach ($fields as $field) {
         assert($field->delete());
     }
     Yii::app()->db->schema->refresh();
     Yii::app()->cache->flush();
     Contacts::model()->refreshMetaData();
     Contacts::model()->resetFieldsPropertyCache();
     AuxLib::debugLogR('Contacts::model ()->getAttributes () = ');
     AuxLib::debugLogR(Contacts::model()->getAttributes());
     parent::tearDownAfterClass();
 }
コード例 #18
0
ファイル: X2ClientScript.php プロジェクト: shuvro35/X2CRM
 /**
  * Performs all the necessary JavaScript/CSS initializations for most parts of the app.
  */
 public function registerMain()
 {
     foreach (array('IS_IPAD', 'RESPONSIVE_LAYOUT') as $layoutConst) {
         defined($layoutConst) or define($layoutConst, false);
     }
     $fullscreen = $this->fullscreen;
     $profile = $this->profile;
     $baseUrl = $this->baseUrl;
     $themeUrl = $this->themeUrl;
     $scriptUrl = $this->scriptUrl;
     $admin = $this->admin;
     $isGuest = $this->isGuest;
     // jQuery and jQuery UI libraries
     $this->registerCoreScript('jquery')->registerCoreScript('jquery.ui')->registerCoreScript('jquery.migrate')->registerCoreScript('bbq');
     $this->registerPackages($this->getDefaultPackages());
     $cldScript = $this->getCurrencyConfigScript();
     AuxLib::registerPassVarsToClientScriptScript('auxlib', array('saveMiscLayoutSettingUrl' => "'" . addslashes(Yii::app()->createUrl('/profile/saveMiscLayoutSetting')) . "'"), 'passAuxLibVars');
     $this->registerX2ModelMappingsScript();
     $this->registerX2Forms();
     $this->registerX2QuickCRUD();
     $this->registerX2Flashes();
     Yii::app()->clientScript->registerScript('csrfTokenScript', "\n            x2.csrfToken = '" . Yii::app()->request->getCsrfToken() . "';\n        ", CClientScript::POS_HEAD);
     $this->registerAttachments();
     $this->registerDateFormats();
     if (YII_DEBUG) {
         $this->registerScriptFile($baseUrl . '/js/Timer.js');
     }
     Yii::app()->clientScript->registerPackage('spectrum');
     // custom scripts
     $this->registerScriptFile($baseUrl . '/js/json2.js')->registerScriptFile($baseUrl . '/js/webtoolkit.sha256.js')->registerScriptFile($baseUrl . '/js/main.js', CCLientScript::POS_HEAD)->registerScriptFile($baseUrl . '/js/auxlib.js', CClientScript::POS_HEAD)->registerScriptFile($baseUrl . '/js/IframeFixOverlay.js', CClientScript::POS_HEAD)->registerScriptFile($baseUrl . '/js/LayoutManager.js')->registerScriptFile($baseUrl . '/js/media.js')->registerScript('formatCurrency-locales', $cldScript, CCLientScript::POS_HEAD)->registerScriptFile($baseUrl . '/js/modernizr.custom.66175.js')->registerScriptFile($baseUrl . '/js/widgets.js')->registerScriptFile($baseUrl . '/js/qtip/jquery.qtip.min.js')->registerScriptFile($baseUrl . '/js/ActionFrames.js')->registerScriptFile($baseUrl . '/js/ColorPicker.js', CCLientScript::POS_END)->registerScriptFile($baseUrl . '/js/PopupDropdownMenu.js', CCLientScript::POS_END)->registerScriptFile($baseUrl . '/js/jQueryOverrides.js', CCLientScript::POS_END)->registerScriptFile($baseUrl . '/js/checklistDropdown/jquery.multiselect.js');
     $this->registerTestingScripts();
     $this->registerDebuggingScripts();
     if (IS_IPAD) {
         $this->registerScriptFile($baseUrl . '/js/jquery.mobile.custom.js');
     }
     $this->registerInitScript();
     $this->registerAuxLibTranslationsScript();
     if (Yii::app()->session['translate']) {
         $this->registerScriptFile($baseUrl . '/js/translator.js');
     }
     $this->registerScriptFile($baseUrl . '/js/backgroundFade.js');
     $this->registerScript('datepickerLanguage', "\n            \$.datepicker.setDefaults(\$.datepicker.regional['']);\n        ");
     $mmPath = Yii::getPathOfAlias('application.extensions.moneymask.assets');
     $aMmPath = Yii::app()->getAssetManager()->publish($mmPath);
     $this->registerScriptFile("{$aMmPath}/jquery.maskMoney.js");
     $this->registerCssFile($baseUrl . '/css/normalize.css', 'all')->registerCssFile($themeUrl . '/css/print.css', 'print')->registerCoreScript('cookie');
     $this->registerCombinedCss();
     if (!RESPONSIVE_LAYOUT && IS_ANDROID) {
         $this->registerCssFile($themeUrl . '/css/androidLayout.css', 'screen, projection');
     } elseif (IS_IPAD) {
         $this->registerCssFile($themeUrl . '/css/ipadLayout.css', 'screen, projection');
     }
     $this->registerScript('fullscreenToggle', '
         window.enableFullWidth = ' . (!Yii::app()->user->isGuest ? $profile->enableFullWidth ? 'true' : 'false' : 'true') . ';
         window.fullscreen = ' . ($fullscreen ? 'true' : 'false') . ';
     ', CClientScript::POS_HEAD);
     if (is_object(Yii::app()->controller->module)) {
         $this->registerScript('saveCurrModule', "\n                x2.currModule = '" . Yii::app()->controller->module->name . "';\n            ", CClientScript::POS_HEAD);
     }
     if (!$isGuest) {
         $this->registerScript('notificationsParams', "\n                x2.notifications = new x2.Notifs ({\n                    disablePopup: " . ($profile->disableNotifPopup ? 'true' : 'false') . ",\n                    translations: {\n                        clearAll: '" . addslashes(Yii::t('app', 'Permanently delete all notifications?')) . "'\n                    }\n                });\n            ", CClientScript::POS_READY);
         $this->registerScriptFile($baseUrl . '/js/jstorage.min.js')->registerScriptFile($baseUrl . '/js/notifications.js', CClientScript::POS_BEGIN);
     }
     if (!$isGuest && ($profile->language == 'he' || $profile->language == 'fa')) {
         $this->registerCss('rtl-language', 'body{text-align:right;}');
     }
     $this->registerCoreScript('rating');
 }
コード例 #19
0
ファイル: Events.php プロジェクト: shuvro35/X2CRM
 private static function parseFilters($filters, &$params)
 {
     unset($filters['filters']);
     $visibility = $filters['visibility'];
     $visibility = str_replace('Public', '1', $visibility);
     $visibility = str_replace('Private', '0', $visibility);
     $visibilityFilter = explode(",", $visibility);
     if ($visibility != "") {
         $visibilityParams = AuxLib::bindArray($visibilityFilter, 'visibility');
         $params = array_merge($params, $visibilityParams);
         $visibilityCondition = " AND visibility NOT IN (" . implode(',', array_keys($visibilityParams)) . ")";
     } else {
         $visibilityCondition = "";
         $visibilityFilter = array();
     }
     $users = $filters['users'];
     if ($users != "") {
         $users = explode(",", $users);
         $users[] = '';
         $users[] = 'api';
         $userFilter = $users;
         if (sizeof($users)) {
             $usersParams = AuxLib::bindArray($users, 'users');
             $params = array_merge($params, $usersParams);
             $userCondition = " AND (user NOT IN (" . implode(',', array_keys($usersParams)) . ")";
         } else {
             $userCondition = "(";
         }
         if (!in_array('Anyone', $users)) {
             $userCondition .= " OR user IS NULL)";
         } else {
             $userCondition .= ")";
         }
     } else {
         $userCondition = "";
         $userFilter = array();
     }
     $types = $filters['types'];
     if ($types != "") {
         $types = explode(",", $types);
         $typeFilter = $types;
         $typesParams = AuxLib::bindArray($types, 'types');
         $params = array_merge($params, $typesParams);
         $typeCondition = " AND (type NOT IN (" . implode(',', array_keys($typesParams)) . ") OR important=1)";
     } else {
         $typeCondition = "";
         $typeFilter = array();
     }
     $subtypes = $filters['subtypes'];
     if (is_array($types) && $subtypes != "") {
         $subtypes = explode(",", $subtypes);
         $subtypeFilter = $subtypes;
         if (sizeof($subtypes)) {
             $subtypeParams = AuxLib::bindArray($subtypes, 'subtypes');
             $params = array_merge($params, $subtypeParams);
             $subtypeCondition = " AND (\n                    type!='feed' OR subtype NOT IN (" . implode(',', array_keys($subtypeParams)) . ") OR important=1)";
         } else {
             $subtypeCondition = "";
         }
     } else {
         $subtypeCondition = "";
         $subtypeFilter = array();
     }
     $ret = array('filters' => array('visibility' => $visibilityFilter, 'users' => $userFilter, 'types' => $typeFilter, 'subtypes' => $subtypeFilter), 'conditions' => array('visibility' => $visibilityCondition, 'users' => $userCondition, 'types' => $typeCondition, 'subtypes' => $subtypeCondition), 'params' => $params);
     return $ret;
 }
コード例 #20
0
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * X2Engine" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2Engine".
 *****************************************************************************************/
/*
Parameters:
    massActions - array of strings - list of available mass actions to select from
    gridId - the id property of the X2GridView instance
    modelName - the modelName property of the X2GridView instance
    selectedAction - string - if set, used to select option from mass actions dropdown
    gridObj - object - the x2gridview instance
*/
Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/X2GridView/X2GridViewMassActionsManager.js', CClientScript::POS_END);
$massActionLabels = array('completeAction' => Yii::t('app', 'Complete selected {actions}', array('{actions}' => strtolower(Modules::displayName(true, 'Actions')))), 'uncompleteAction' => Yii::t('app', 'Uncomplete selected {actions}', array('{actions}' => strtolower(Modules::displayName(true, 'Actions')))), 'newList' => Yii::t('app', 'New list from selection'), 'addToList' => Yii::t('app', 'Add selected to list'), 'removeFromList' => Yii::t('app', 'Remove selected from list'));
AuxLib::registerTranslationsScript('massActions', array('deleteprogressBarDialogTitle' => 'Mass Deletion in Progress', 'updateFieldprogressBarDialogTitle' => 'Mass Update in Progress', 'progressBarDialogTitle' => 'Mass Action in Progress', 'deleted' => 'deleted', 'tagged' => 'tagged', 'added' => 'added', 'updated' => 'updated', 'removed' => 'removed', 'doubleConfirmDialogTitle' => 'Confirm Deletion', 'addedItems' => 'Added items to list', 'addToList' => 'Add selected to list', 'removeFromList' => 'Remove selected from list', 'newList' => 'Create new list from selected', 'add' => 'Add to list', 'remove' => 'Remove from list', 'noticeFlashList' => 'Mass action exectuted with', 'errorFlashList' => 'Mass action exectuted with', 'noticeItemName' => 'warnings', 'errorItemName' => 'errors', 'successItemName' => 'Close', 'blankListNameError' => 'Cannot be left blank', 'passwordError' => 'Password cannot be left blank', 'close' => 'Close', 'cancel' => 'Cancel', 'create' => 'Create', 'pause' => 'Pause', 'stop' => 'Stop', 'resume' => 'Resume', 'complete' => 'Complete', 'tag' => 'Tag', 'update' => 'Update', 'tagSelected' => 'Tag selected', 'deleteSelected' => 'Delete selected', 'delete' => 'Delete', 'updateField' => 'Update fields of selected', 'emptyTagError' => 'At least one tag must be included'));
Yii::app()->clientScript->registerCss('massActionsCss', "\n\n.x2-gridview-mass-action-outer {\n    position: relative;\n}\n\n@media (max-width: 820px) and (min-width: 658px) {\n    .grid-view.fullscreen .x2-gridview-top-pager {\n        display: none;\n    }\n}\n\n\n/*\nCheck all records in data provider feature\n*/\n.grid-view .select-all-records-on-all-pages-strip-container {\n    margin-right: -1px;\n}\n.grid-view .x2-gridview-fixed-top-bar-outer .select-all-records-on-all-pages-strip-container {\n    margin-right: 6px;\n    margin-left: 3px;\n}\n\n.grid-view .select-all-records-on-all-pages-strip-container {\n    text-align: center;\n    border-right: 1px solid rgb(207, 207, 207);\n    border-bottom: 1px solid rgb(199, 199, 199);\n    position: relative;\n    z-index: 1;\n}\n\n.grid-view .select-all-records-on-all-pages-strip-container .select-all-notice,\n.grid-view .select-all-records-on-all-pages-strip-container .all-selected-notice {\n    padding: 4px;\n}\n\n.grid-view .select-all-records-on-all-pages-strip-container .select-all-notice {\n    background: rgb(255, 255, 185);\n}\n\n.grid-view .select-all-records-on-all-pages-strip-container .all-selected-notice {\n    background: rgb(203, 255, 201);\n}\n\nbody.no-widgets .grid-view .x2-gridview-fixed-top-bar-outer .select-all-records-on-all-pages-strip-container {\n    margin-right: 0;\n}\n\n.x2-mobile-layout .select-all-records-on-all-pages-strip-container {\n    margin-left: 0;\n    margin-right: -1px;\n}\n\n.grid-view .container-clone {\n    visibility: hidden;\n}\n\n.x2-mobile-layout .x2grid-body-container .container-clone,\n.x2grid-body-container.x2-gridview-body-without-fixed-header .container-clone {\n    display: none !important;\n}\n\n/*\nFlashes container\n*/\n\n.super-mass-action-feedback-box {\n    margin: 5px 0;\n    border: 1px solid rgb(176, 176, 176);\n    background: rgb(250, 250, 250);\n    box-shadow: inset 1px 1px rgb(219, 219, 219);\n    padding: 4px;\n    height: 76px;\n    overflow-y: scroll;\n}\n\n.super-mass-action-feedback-box .success-flash {\n    color: green;\n}\n.super-mass-action-feedback-box .error-flash {\n    color: red;\n}\n\n\n\n#x2-gridview-flashes-container.fixed-flashes-container {\n    position: fixed;\n    opacity: 0.9;\n    bottom: 5px;\n}\n\n#x2-gridview-flashes-container {\n    margin-top: 5px;\n    margin-right: 5px;\n}\n\n#x2-gridview-flashes-container > div {\n    margin-top: 5px;\n    margin-left: 4px;\n}\n\n#x2-gridview-flashes-container .flash-list-header {\n    margin-bottom: 4px;\n}\n\n#x2-gridview-flashes-container .x2-gridview-flashes-list {\n    clear: both;\n    margin-bottom: 5px;\n}\n\n#x2-gridview-flashes-container .flash-list-left-arrow,\n#x2-gridview-flashes-container .flash-list-down-arrow {\n    margin-left: 6px;\n    margin-top: 3px;\n}\n\n\n\n/*\nbuttons \n*/\n\n.mass-action-more-button-container .x2-down-arrow {\n    margin-left: 30px;\n    margin-top: 11px;\n}\n\n.mass-action-more-button-container .more-button-arrow {\n    height: 5px;\n}\n\n.mass-action-more-button-container .more-button-label {\n    display: inline !important;\n    float: left;\n    margin-right:5px;\n}\n\n.mass-action-more-button-container {\n    margin: 0 5px 0 0;\n    display: inline-block;\n}\n\n.mass-action-more-button-container button {\n    display: inline;\n    height: 26px;\n}\n\n\n\n\n/*\nmore drop down list\n*/\n\n.x2-gridview-mass-action-buttons .more-drop-down-list.stuck {\n    position: absolute !important;\n    /*top: 74px !important;*/\n}\n\n.x2-gridview-mass-action-buttons .more-drop-down-list {\n    position: absolute;\n    top: 67px;\n    z-index: 99;\n    list-style-type: none;\n    background: #fff;\n    border: 1px solid #999;\n    -moz-box-shadow: 0 0 15px 0 rgba(0,0,0,0.5);\n    -webkit-box-shadow: 0 0 15px 0 rgba(0,0,0,0.5);\n    box-shadow: 0 0 15px 0 rgba(0,0,0,0.5);\n    padding: 5px 0px 5px 0px;\n    clip: rect(0px,1000px,1000px,-10px);\n}\n\n.x2-gridview-mass-action-buttons .more-drop-down-list li {\n    line-height: 17px;\n    padding: 0 10px 0 10px;\n    cursor: default;\n    color: black;\n}\n.x2-gridview-mass-action-buttons .more-drop-down-list li:hover {\n    background: #eee;\n}\n\n/*\ngeneral mass actions styling\n*/\n\n#mass-action-dialog-loading-anim {\n    margin-right: 30px;\n}\n\n.x2-gridview-mass-action-buttons .dialog-help-text {\n    margin-bottom: 5px;\n}\n\n.x2-gridview-mass-action-buttons {\n    margin: 0 5px 0 0;\n    display: inline-block;\n}\n");
Yii::app()->clientScript->registerResponsiveCss('massActionsCssResponsive', "\n\n@media (max-width: 657px) {\n    .x2-gridview-mass-action-buttons {\n        position: absolute;\n        width: 137px;\n        top: -41px;\n        right: -179px;\n        margin: 0px;\n    }\n    .show-top-buttons .x2-gridview-mass-action-buttons {\n        right: -183px; \n    }\n}\n\n@media (min-width: 658px) {\n    .x2-gridview-mass-action-buttons .more-drop-down-list.fixed-header {\n        /*position: fixed;*/\n    }\n    .x2-gridview.fullscreen .x2-gridview-mass-action-buttons .more-drop-down-list.fixed-header {\n        position: absolute;\n    }\n}\n\n");
// destroy mass action dialogs, save checks so that can be preserved through grid update
$beforeUpdateJSString = "\n    x2.DEBUG && console.log ('beforeUpdateJSString');\n    \n    \n    \$('.mass-action-dialog').each (function () {\n        //x2.massActions.DEBUG && console.log ('destroying dialog loop');\n        if (\$(this).closest ('.ui-dialog').length) {\n            //x2.massActions.DEBUG && console.log ('destroying dialog');\n            \$(this).dialog ('destroy');\n            \$(this).hide ();\n        }\n    });\n\n    // save to preserve checks\n    x2." . $namespacePrefix . "MassActionsManager.saveSelectedRecords ();\n\n    // show loading overlay to prevent grid view user interaction\n    \$('#" . $gridId . " .x2-gridview-updating-anim').show ();\n";
$gridObj->addToBeforeAjaxUpdate($beforeUpdateJSString);
// reapply event handlers and checks
$afterUpdateJSString = "\n    x2.DEBUG && console.log ('afterUpdateJSSTring');\n    if (typeof x2." . $namespacePrefix . "MassActionsManager !== 'undefined') \n        x2." . $namespacePrefix . "MassActionsManager.reinit (); \n    \$('#" . $gridId . " .x2-gridview-updating-anim').hide ();\n";
$gridObj->addToAfterAjaxUpdate($afterUpdateJSString);
foreach ($massActionObjs as $obj) {
    $obj->registerPackages();
}
Yii::app()->clientScript->registerScript($namespacePrefix . 'massActionsInitScript', "\n    if (typeof x2." . $namespacePrefix . "MassActionsManager === 'undefined') {\n        x2." . $namespacePrefix . "MassActionsManager = new x2.GridViewMassActionsManager ({\n            massActions: " . CJSON::encode($massActions) . ",\n            gridId: '" . $gridId . "',\n            namespacePrefix: '" . $namespacePrefix . "',\n            gridSelector: '#" . $gridId . "',\n            fixedHeader: " . ($fixedHeader ? 'true' : 'false') . ",\n            massActionUrl: '" . Yii::app()->request->getScriptUrl() . '/' . lcfirst($gridObj->moduleName) . '/x2GridViewMassAction' . "',\n             \n            modelName: '" . $modelName . "',\n            translations: " . CJSON::encode(array('deleteprogressBarDialogTitle' => Yii::t('app', 'Mass Deletion in Progress'), 'updateFieldprogressBarDialogTitle' => Yii::t('app', 'Mass Update in Progress'), 'progressBarDialogTitle' => Yii::t('app', 'Mass Action in Progress'), 'deleted' => Yii::t('app', 'deleted'), 'tagged' => Yii::t('app', 'tagged'), 'added' => Yii::t('app', 'added'), 'updated' => Yii::t('app', 'updated'), 'removed' => Yii::t('app', 'removed'), 'doubleConfirmDialogTitle' => Yii::t('app', 'Confirm Deletion'), 'addedItems' => Yii::t('app', 'Added items to list'), 'addToList' => Yii::t('app', 'Add selected to list'), 'removeFromList' => Yii::t('app', 'Remove selected from list'), 'newList' => Yii::t('app', 'Create new list from selected'), 'moveToFolder' => Yii::t('app', 'Move selected messages'), 'moveOneToFolder' => Yii::t('app', 'Move message'), 'move' => Yii::t('app', 'Move'), 'add' => Yii::t('app', 'Add to list'), 'remove' => Yii::t('app', 'Remove from list'), 'noticeFlashList' => Yii::t('app', 'Mass action exectuted with'), 'errorFlashList' => Yii::t('app', 'Mass action exectuted with'), 'noticeItemName' => Yii::t('app', 'warnings'), 'errorItemName' => Yii::t('app', 'errors'), 'successItemName' => Yii::t('app', 'Close'), 'blankListNameError' => Yii::t('app', 'Cannot be left blank'), 'passwordError' => Yii::t('app', 'Password cannot be left blank'), 'close' => Yii::t('app', 'Close'), 'cancel' => Yii::t('app', 'Cancel'), 'create' => Yii::t('app', 'Create'), 'pause' => Yii::t('app', 'Pause'), 'stop' => Yii::t('app', 'Stop'), 'resume' => Yii::t('app', 'Resume'), 'complete' => Yii::t('app', 'Complete'), 'tag' => Yii::t('app', 'Tag'), 'update' => Yii::t('app', 'Update'), 'tagSelected' => Yii::t('app', 'Tag selected'), 'deleteSelected' => Yii::t('app', 'Delete selected'), 'delete' => Yii::t('app', 'Delete'), 'updateField' => Yii::t('app', 'Update fields of selected'), 'emptyTagError' => Yii::t('app', 'At least one tag must be included'))) . ",\n            expandWidgetSrc: '" . Yii::app()->getTheme()->getBaseUrl() . '/images/icons/Expand_Widget.png' . "',\n            collapseWidgetSrc: '" . Yii::app()->getTheme()->getBaseUrl() . '/images/icons/Collapse_Widget.png' . "',\n            closeWidgetSrc: '" . Yii::app()->getTheme()->getBaseUrl() . '/images/icons/Close_Widget.png' . "',\n            progressBarDialogSelector: '#{$namespacePrefix}-progress-dialog',\n            enableSelectAllOnAllPages: " . ($gridObj->enableSelectAllOnAllPages ? 'true' : 'false') . ",\n            totalItemCount: {$gridObj->dataProvider->totalItemCount},\n            idChecksum: '{$idChecksum}',\n        });\n    } else {\n        // grid was refreshed, total item count may have changed\n        x2.{$namespacePrefix}MassActionsManager.totalItemCount = \n            {$gridObj->dataProvider->totalItemCount};\n        x2.{$namespacePrefix}MassActionsManager.idChecksum = \n            '{$idChecksum}';\n    }\n", CClientScript::POS_END);
?>

<span class='x2-gridview-mass-action-outer'>
コード例 #21
0
ファイル: LoginThemeHelper.php プロジェクト: keyeMyria/CRM
 /**
  * Saves a profile Theme to the cookies
  * @param string $themeName name of the theme to be set. 
  */
 public static function saveProfileTheme($themeName)
 {
     //Set a cookie for the profile theme set
     if ($themeName != ThemeGenerator::$defaultLight) {
         AuxLib::setCookie(self::PROFILE_COOKIE, $themeName, self::$cookieLength);
     }
     // Set a cookie for the login screen
     if (isset($_COOKIE[self::LOGIN_THEME_COOKIE])) {
         AuxLib::setCookie(self::LOGIN_THEME_COOKIE, $themeName, self::$cookieLength);
     }
 }
コード例 #22
0
ファイル: X2List.php プロジェクト: xl602/X2CRM
 /**
  * Save associated criterion objects for a dynamic list
  *
  * Takes data from the dynamic list criteria designer form and turns them
  * into {@link X2ListCriterion} records.
  */
 public function processCriteria()
 {
     X2ListCriterion::model()->deleteAllByAttributes(array('listId' => $this->id));
     // delete old criteria
     foreach (array('attribute', 'comparison', 'value') as $property) {
         // My lazy refactor: bring properties into the current scope as
         // temporary variables with their names pluralized
         ${"{$property}s"} = $this->criteriaInput[$property];
     }
     $comparisonList = self::getComparisonList();
     $contactModel = Contacts::model();
     $fields = $contactModel->getFields(true);
     for ($i = 0; $i < count($attributes); $i++) {
         // create new criteria
         if ((array_key_exists($attributes[$i], $contactModel->attributeLabels()) || $attributes[$i] == 'tags') && array_key_exists($comparisons[$i], $comparisonList)) {
             $fieldRef = isset($fields[$attributes[$i]]) ? $fields[$attributes[$i]] : null;
             if ($fieldRef instanceof Fields && $fieldRef->type == 'link') {
                 $nameList = explode(',', $values[$i]);
                 $namesParams = AuxLib::bindArray($nameList);
                 $namesIn = AuxLib::arrToStrList(array_keys($namesParams));
                 $lookupModel = X2Model::model(ucfirst($fieldRef->linkType));
                 $lookupModels = $lookupModel->findAllBySql('SELECT * FROM `' . $lookupModel->tableName() . '` ' . 'WHERE `name` IN ' . $namesIn, $namesParams);
                 if (!empty($lookupModels)) {
                     $values[$i] = implode(',', array_map(function ($m) {
                         return $m->nameId;
                     }, $lookupModels));
                     //$lookup->nameId;
                 }
             }
             $criterion = new X2ListCriterion();
             $criterion->listId = $this->id;
             $criterion->type = 'attribute';
             $criterion->attribute = $attributes[$i];
             $criterion->comparison = $comparisons[$i];
             $criterion->value = $values[$i];
             $criterion->save();
         }
     }
 }
コード例 #23
0
ファイル: X2ConditionList.php プロジェクト: tymiles003/X2CRM
 public static function listOption($attributes, $name)
 {
     if ($attributes instanceof Fields) {
         $attributes = $attributes->getAttributes();
     }
     $data = array('name' => $name, 'label' => $attributes['attributeLabel']);
     if (isset($attributes['type']) && $attributes['type']) {
         $data['type'] = $attributes['type'];
     }
     if (isset($attributes['required']) && $attributes['required']) {
         $data['required'] = 1;
     }
     if (isset($attributes['readOnly']) && $attributes['readOnly']) {
         $data['readOnly'] = 1;
     }
     if (isset($attributes['type'])) {
         if ($attributes['type'] === 'assignment' || $attributes['type'] === 'optionalAssignment') {
             $data['options'] = AuxLib::dropdownForJson(X2Model::getAssignmentOptions(true, true));
         } elseif ($attributes['type'] === 'dropdown' && isset($attributes['linkType'])) {
             $data['linkType'] = $attributes['linkType'];
             $data['options'] = AuxLib::dropdownForJson(Dropdowns::getItems($attributes['linkType']));
         } elseif ($attributes['type'] === 'link' && isset($attributes['linkType'])) {
             $staticLinkModel = X2Model::model($attributes['linkType']);
             if (array_key_exists('X2LinkableBehavior', $staticLinkModel->behaviors())) {
                 $data['linkType'] = $attributes['linkType'];
                 $data['linkSource'] = Yii::app()->controller->createUrl($staticLinkModel->autoCompleteSource);
             }
         }
     }
     return $data;
 }
コード例 #24
0
ファイル: ChartWidget.php プロジェクト: tymiles003/X2CRM
 /**
  * overrides parent method. Adds JS file necessary to run the setup script.
  */
 public function getPackages()
 {
     if (!isset($this->_packages)) {
         $this->_packages = array_merge(parent::getPackages(), array('ChartWidgetJS' => array('baseUrl' => Yii::app()->request->baseUrl, 'js' => array('js/jqplot/jquery.jqplot.js', 'js/jqplot/plugins/jqplot.pieRenderer.js', 'js/jqplot/plugins/jqplot.categoryAxisRenderer.js', 'js/jqplot/plugins/jqplot.pointLabels.js', 'js/jqplot/plugins/jqplot.dateAxisRenderer.js', 'js/jqplot/plugins/jqplot.highlighter.js', 'js/jqplot/plugins/jqplot.enhancedLegendRenderer.js', 'js/lib/moment-with-locales.min.js', 'js/sortableWidgets/ChartWidget.js', 'js/X2Chart/X2Chart.js'), 'depends' => array('SortableWidgetJS')), 'ChartWidgetCss' => array('baseUrl' => Yii::app()->getTheme()->getBaseUrl(), 'css' => array('css/x2chart.css')), 'ChartWidgetCssExt' => array('baseUrl' => Yii::app()->request->baseUrl, 'css' => array('js/jqplot/jquery.jqplot.css'))));
         if (AuxLib::isIE8()) {
             $this->_packages['ChartWidgetJS']['js'][] = 'js/jqplot/excanvas.js';
         }
     }
     return $this->_packages;
 }
コード例 #25
0
 /**
  * Execute specified mass action on specified records
  */
 public function run()
 {
     if (Yii::app()->user->isGuest) {
         Yii::app()->controller->redirect(Yii::app()->controller->createUrl('/site/login'));
     }
     if (Yii::app()->request->getRequestType() === 'GET') {
         $_POST = $_GET;
     }
     if (isset($_POST['passConfirm']) && $_POST['passConfirm']) {
         MassAction::superMassActionPasswordConfirmation();
         return;
     }
     if (!isset($_POST['massAction']) || (!isset($_POST['superCheckAll']) || !$_POST['superCheckAll']) && (!isset($_POST['gvSelection']) || !is_array($_POST['gvSelection']))) {
         /**/
         AuxLib::debugLogR('run error');
         throw new CHttpException(400, Yii::t('app', 'Bad Request'));
     }
     $massAction = $_POST['massAction'];
     $massActionInstance = $this->getInstanceFor($massAction);
     if (isset($_POST['superCheckAll']) && $_POST['superCheckAll']) {
         $uid = $_POST['uid'];
         $idChecksum = $_POST['idChecksum'];
         $totalItemCount = intval($_POST['totalItemCount']);
         $massActionInstance->superExecute($uid, $totalItemCount, $idChecksum);
     } else {
         $gvSelection = $_POST['gvSelection'];
         $massActionInstance->beforeExecute();
         $massActionInstance->execute($gvSelection);
         $massActionInstance::echoFlashes();
     }
 }
コード例 #26
0
ファイル: X2FlowTrigger.php プロジェクト: tymiles003/X2CRM
 /**
  * @param mixed $subject if applicable, the value to compare $subject with (value of model 
  *  attribute)
  * @param string $operator the type of comparison to be used
  * @param mixed $value the value being analyzed (specified in config menu)
  * @return boolean
  */
 public static function evalComparison($subject, $operator, $value = null, Fields $field = null)
 {
     $value = self::parseArray($operator, $value);
     //        if (!in_array ($operator, $expectsArray, true) && is_array ($value)) {
     //            if (count ($value) > 1) {
     //                return false;
     //            } else {
     //                $value = array_pop ($value);
     //            }
     //        }
     switch ($operator) {
         case '=':
             // check for multiselect dropdown
             if ($field && $field->type === 'dropdown') {
                 $dropdown = $field->getDropdown();
                 if ($dropdown && $dropdown->multi) {
                     $subject = StringUtil::jsonDecode($subject, false);
                     AuxLib::coerceToArray($subject);
                     AuxLib::coerceToArray($value);
                     return $subject === $value;
                 }
                 // check for muti-assignment field
             } else {
                 if ($field && $field->type === 'assignment' && $field->linkType === 'multiple') {
                     $subject = explode(Fields::MULTI_ASSIGNMENT_DELIM, $subject);
                     AuxLib::coerceToArray($subject);
                     AuxLib::coerceToArray($value);
                     return $subject === $value;
                 }
             }
             // this case occurs when dropdown or assignment fields are changed from multiple
             // to single selection, and flow conditions are left over from before the change
             // was made
             if (is_array($value)) {
                 AuxLib::coerceToArray($subject);
             }
             return $subject == $value;
         case '>':
             return $subject > $value;
         case '<':
             return $subject < $value;
         case '>=':
             return $subject >= $value;
         case '<=':
             return $subject <= $value;
         case 'between':
             if (count($value) !== 2) {
                 return false;
             }
             return $subject >= min($value) && $subject <= max($value);
         case '<>':
         case '!=':
             return $subject != $value;
         case 'notEmpty':
             return $subject !== null && $subject !== '';
         case 'empty':
             return $subject === null || trim($subject) === '';
         case 'list':
             if (count($value) === 0) {
                 // if the list is empty,
                 return false;
             }
             // A isn't in it
             foreach ($value as &$val) {
                 if ($subject == $val) {
                     return true;
                 }
             }
             return false;
         case 'notList':
             if (count($value) === 0) {
                 // if the list is empty,
                 return true;
             }
             // A isn't *not* in it
             foreach ($value as &$val) {
                 if ($subject == $val) {
                     return false;
                 }
             }
             return true;
         case 'noContains':
             return stripos($subject, $value) === false;
         case 'contains':
         default:
             return stripos($subject, $value) !== false;
     }
 }
コード例 #27
0
ファイル: login.php プロジェクト: keyeMyria/CRM
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by X2Engine".
 *****************************************************************************************/
mb_internal_encoding('UTF-8');
mb_regex_encoding('UTF-8');
Yii::app()->params->profile = Profile::model()->findByPk(1);
// use the admin's profile since the user hasn't logged in
$jsVersion = '?' . Yii::app()->params->buildDate;
// blueprint CSS framework
$themeURL = Yii::app()->theme->getBaseUrl();
Yii::app()->clientScript->registerCssFile($themeURL . '/css/screen.css' . $jsVersion, 'screen, projection');
Yii::app()->clientScript->registerCssFile($themeURL . '/css/print.css' . $jsVersion, 'print');
Yii::app()->clientScript->registerCssFile($themeURL . '/css/main.css' . $jsVersion, 'screen, projection');
Yii::app()->clientScript->registerCssFile($themeURL . '/css/form.css' . $jsVersion, 'screen, projection');
Yii::app()->clientScript->registerCssFile($themeURL . '/css/ui-elements.css' . $jsVersion, 'screen, projection');
if (AuxLib::getIEVer() < 9) {
    Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/lib/aight/aight.js');
}
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/lib/jquery-migrate-1.2.1.js');
$backgroundImg = '';
$defaultOpacity = 1;
$themeCss = '';
$checkResult = false;
$checkFiles = array('themes/x2engine/images/x2footer.png' => '1393e4af54ababdcf76fac7f075b555b', 'themes/x2engine/images/x2-mini-icon.png' => '153d66b514bf9fb0d82a7521a3c64f36');
foreach ($checkFiles as $key => $value) {
    if (!file_exists($key) || hash_file('md5', $key) != $value) {
        $checkResult = true;
    }
}
$theme2Css = '';
if ($checkResult) {
コード例 #28
0
?>
                <div class='row'>
                <?php 
if (AuxLib::getIEVer() < 10) {
    echo $form->label($model, 'username', array('style' => $profile ? 'display: none;' : ''));
}
if ($profile) {
    echo $form->hiddenField($model, 'username');
} else {
    echo $form->textField($model, 'username', array('placeholder' => Yii::t('app', 'Username'), 'value' => $_GET['username']));
}
?>
                </div>
                <div class='row'>
                <?php 
if (AuxLib::getIEVer() < 10) {
    echo $form->label($model, 'password', array('style' => 'margin-top:5px;'));
}
echo $form->passwordField($model, 'password', array('placeholder' => Yii::t('app', 'Password'), 'value' => $_GET['username']));
echo $form->error($model, 'password');
?>
                </div>
                <?php 
if ($model->useCaptcha && CCaptcha::checkRequirements()) {
    ?>
                <div class="row captcha-row">
                    <?php 
    echo '<div id="captcha-container">';
    $this->widget('CCaptcha', array('clickableImage' => true, 'showRefreshButton' => false, 'imageOptions' => array('id' => 'captcha-image', 'style' => 'display:block;cursor:pointer;', 'title' => Yii::t('app', 'Click to get a new image'))));
    echo '</div>';
    echo '<p class="hint">' . Yii::t('app', 'Please enter the letters in the image above.') . '</p>';
コード例 #29
0
ファイル: AdminController.php プロジェクト: xl602/X2CRM
 /**
  * Edit a previously created dropdown
  */
 public function actionEditDropdown()
 {
     $model = new Dropdowns();
     // TODO: validate dropdown select client-side
     if (isset($_POST['Dropdowns']['id']) && ctype_digit($_POST['Dropdowns']['id'])) {
         $model = Dropdowns::model()->findByPk($_POST['Dropdowns']['id']);
         if (!isset($model)) {
             throw new CHttpException(404, Yii::t('app', 'Dropdown could not be found'));
         }
         if ($model->id == Actions::COLORS_DROPDOWN_ID) {
             if (AuxLib::issetIsArray($_POST['Dropdowns']['values']) && AuxLib::issetIsArray($_POST['Dropdowns']['labels']) && count($_POST['Dropdowns']['values']) === count($_POST['Dropdowns']['labels'])) {
                 if (AuxLib::issetIsArray($_POST['Admin']) && isset($_POST['Admin']['enableColorDropdownLegend'])) {
                     Yii::app()->settings->enableColorDropdownLegend = $_POST['Admin']['enableColorDropdownLegend'];
                     Yii::app()->settings->save();
                 }
                 $options = array_combine($_POST['Dropdowns']['values'], $_POST['Dropdowns']['labels']);
                 $temp = array();
                 foreach ($options as $value => $label) {
                     if ($value != "") {
                         $temp[$value] = $label;
                     }
                 }
                 $model->options = json_encode($temp);
                 $model->save();
             }
         } else {
             $model->attributes = $_POST['Dropdowns'];
             $temp = array();
             if (is_array($model->options) && count($model->options) > 0) {
                 foreach ($model->options as $option) {
                     if ($option != "") {
                         $temp[$option] = $option;
                     }
                 }
                 $model->options = json_encode($temp);
                 if ($model->save()) {
                 }
             }
         }
     }
     $this->redirect('manageDropDowns');
 }
コード例 #30
0
ファイル: TimerUtil.php プロジェクト: tymiles003/X2CRM
 public function read($label = '')
 {
     /**/
     AuxLib::debugLogR($label . round($this->endTime - $this->startTime, 2) . "\n");
     return $this;
 }