Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • None
  • system
    • base
    • caching
    • console
    • db
      • ar
      • schema
    • validators
    • web
      • actions
      • auth
      • helpers
      • widgets
        • captcha
        • pagers
  • zii
    • widgets
      • grid

Classes

  • ActionFormModel
  • ArrayUtil
  • ArrayValidator
  • AssociatedMediaBehavior
  • AuxLib
  • Changelog
  • DetailView
  • EncryptUtilTmp
  • EventsWidgetFieldFormatter
  • FailedLogins
  • FieldFormatter
  • FieldFormatterBase
  • FieldInputRenderer
  • FileFieldBehavior
  • FiltersForm
  • FilterUtil
  • FineDiff
  • FineDiffCopyOp
  • FineDiffDeleteOp
  • FineDiffInsertOp
  • FineDiffOp
  • FineDiffOps
  • FineDiffReplaceOp
  • GlobalCSSFormModel
  • GlobalImportFormModel
  • GoogleAuthenticator
  • JSONFieldsBehavior
  • JSONResponse
  • MediaFieldFormatter
  • MediaSelector
  • MobileActiveRecordFieldFormatter
  • MobileActivityFeed
  • MobileChartDashboard
  • MobileFieldFormatter
  • MobileFieldInputRenderer
  • ModuleModelNameValidator
  • MultiChildNode
  • MultiTypeAutocomplete
  • PasswordUtil
  • ProductFeature
  • ProfileWidgetLayout
  • QueryParamGenerator
  • RecordLimitBehavior
  • RecordView
  • RecordViewWidgetLayout
  • RelationshipsGridModel
  • RelationshipsJoin
  • RepairUserDataCommand
  • RequestUtil
  • RequiredIfNotSetValidator
  • ResponseUtil
  • RunMigrationScriptCommand
  • ServiceWebFormDesigner
  • Settings
  • StringUtil
  • TestEmailAction
  • TestEmailActionForm
  • ThemeGenerator
  • TimerUtil
  • TopicsFieldFormatter
  • TopicsWidgetLayout
  • TransactionalViewFieldFormatter
  • UrlUtil
  • ValidLinkValidator
  • WebFormDesigner
  • WebLeadFormDesigner
  • X2ActiveRecordBehavior
  • X2ActiveRecordFieldFormatter
  • X2ButtonColumn
  • X2ConditionList
  • X2ConsoleCommand
  • X2ControllerBehavior
  • X2DataColumn
  • X2DuplicateBehavior
  • X2Flashes
  • X2GridViewFieldFormatter
  • X2IPAddress
  • X2LeadsDataColumn
  • X2MergeableBehavior
  • X2MessageSource
  • X2MobileControllerBehavior
  • X2MobileProfileControllerBehavior
  • X2MobileQuotesControllerBehavior
  • X2MobileSiteControllerBehavior
  • X2MobileTopicsControllerBehavior
  • X2ModelConversionBehavior
  • X2ModelConversionWidget
  • X2ModelForeignKeyValidator
  • X2ModelUniqueIndexValidator
  • X2NonWebUser
  • X2StaticDropdown
  • X2StaticField
  • X2StaticFieldsBehavior
  • X2UrlManager
  • X2Validator
  • X2WidgetBehavior

Interfaces

  • AdminOwnedCredentials

Exceptions

  • CampaignMailingException
  • CodeExchangeException
  • GetCredentialsException
  • NoRefreshTokenException
  • NoUserIdException
  • StringUtilException

Functions

  • checkCurrency
  • checkDNS
  • checkServerVar
  • checkTimezone
  • decodeQuotes
  • echoIcons
  • encodeQuotes
  • exceptionForError
  • getField
  • getLanguageName
  • getModuleTitle
  • handleReqError
  • handleReqException
  • installer_t
  • installer_tr
  • isAllowedDir
  • mediaMigrationRrmdir
  • migrateMediaDir
  • printGraph
  • printR
  • renderFields
  • reqShutdown
  • RIP
  • translateOptions
  • tryGetRemote
  • Overview
  • Package
  • Function
  • Tree
  1: <?php
  2: /*****************************************************************************************
  3:  * X2Engine Open Source Edition is a customer relationship management program developed by
  4:  * X2Engine, Inc. Copyright (C) 2011-2016 X2Engine Inc.
  5:  * 
  6:  * This program is free software; you can redistribute it and/or modify it under
  7:  * the terms of the GNU Affero General Public License version 3 as published by the
  8:  * Free Software Foundation with the addition of the following permission added
  9:  * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
 10:  * IN WHICH THE COPYRIGHT IS OWNED BY X2ENGINE, X2ENGINE DISCLAIMS THE WARRANTY
 11:  * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
 12:  * 
 13:  * This program is distributed in the hope that it will be useful, but WITHOUT
 14:  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 15:  * FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
 16:  * details.
 17:  * 
 18:  * You should have received a copy of the GNU Affero General Public License along with
 19:  * this program; if not, see http://www.gnu.org/licenses or write to the Free
 20:  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 21:  * 02110-1301 USA.
 22:  * 
 23:  * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley,
 24:  * California 95067, USA. or at email address contact@x2engine.com.
 25:  * 
 26:  * The interactive user interfaces in modified source and object code versions
 27:  * of this program must display Appropriate Legal Notices, as required under
 28:  * Section 5 of the GNU Affero General Public License version 3.
 29:  * 
 30:  * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 31:  * these Appropriate Legal Notices must retain the display of the "Powered by
 32:  * X2Engine" logo. If the display of the logo is not reasonably feasible for
 33:  * technical reasons, the Appropriate Legal Notices must display the words
 34:  * "Powered by X2Engine".
 35:  *****************************************************************************************/
 36: 
 37: /*
 38: Parameters:
 39:     type - string, the web form type ('weblead' | 'weblist' | 'service')
 40:     model - the model associated with the form, set to Contacts by default
 41: */
 42: 
 43: 
 44: mb_internal_encoding('UTF-8');
 45: mb_regex_encoding('UTF-8');
 46: Yii::app()->params->profile = Profile::model()->findByPk(1);
 47: if (empty($type)) $type = 'weblead';
 48: if (empty($model)) $model = Contacts::model ();
 49: 
 50: 
 51: 
 52: if ($type === 'service') {
 53:     $modelName = 'Services';
 54: } else if ($type === 'weblead')  {
 55:     $modelName = 'Contacts';
 56: }
 57: 
 58: 
 59: $defaultFields;
 60: if ($type === 'weblead') {
 61:     $defaultFields = array (
 62:         array (
 63:             'fieldName' => 'firstName',
 64:             'position' => 'top',
 65:             'required' => 1
 66:         ),
 67:         array (
 68:             'fieldName' => 'lastName',
 69:             'position' => 'top',
 70:             'required' => 1
 71:         ),
 72:         array (
 73:             'fieldName' => 'email',
 74:             'position' => 'top',
 75:             'required' => 1
 76:         ),
 77:         array (
 78:             'fieldName' => 'phone',
 79:             'position' => 'top',
 80:             'required' => 0
 81:         ),
 82:         array (
 83:             'fieldName' => 'backgroundInfo',
 84:             'position' => 'top',
 85:             'required' => 0
 86:         ),
 87:     );
 88: } else if ($type === 'service') {
 89:     $defaultFields = array (
 90:         array (
 91:             'fieldName' => 'firstName',
 92:             'position' => 'top',
 93:             'required' => 1
 94:         ),
 95:         array (
 96:             'fieldName' => 'lastName',
 97:             'position' => 'top',
 98:             'required' => 1
 99:         ),
100:         array (
101:             'fieldName' => 'email',
102:             'position' => 'top',
103:             'required' => 1
104:         ),
105:         array (
106:             'fieldName' => 'phone',
107:             'position' => 'top',
108:             'required' => 0
109:         ),
110:         array (
111:             'fieldName' => 'description',
112:             'position' => 'top',
113:             'required' => 0
114:         ),
115:     );
116: }
117: 
118: $useDefaults = false;
119: 
120: 
121:     $fieldList = $defaultFields;
122:     $useDefaults = true;
123: 
124: 
125: $fieldTypes = array_map (function ($elem) { 
126:     if ($elem['required']) return $elem['fieldName']; }, $fieldList);
127: 
128: if ($type === 'service') {
129:     $contactFields = array('firstName', 'lastName', 'email', 'phone');
130: } else {
131:     $contactFields = null;
132: }
133: 
134: ?>
135: 
136: <!DOCTYPE html>
137: <html xmlns="http://www.w3.org/1999/xhtml"
138:  xml:lang="<?php echo Yii::app()->language; ?>" lang="<?php echo Yii::app()->language; ?>">
139: <head>
140: <meta charset="UTF-8" />
141: <meta name="language" content="<?php echo Yii::app()->language; ?>" />
142: <title><?php echo CHtml::encode($this->pageTitle); ?></title>
143: <?php $this->renderGaCode('public'); ?>
144: 
145: <script type="text/javascript"
146:  src="<?php echo Yii::app()->clientScript->coreScriptUrl . '/jquery.js'; ?>">
147: </script>
148: 
149: <?php
150: 
151: 
152: ?>
153: 
154: <style type="text/css">
155: html {
156:     <?php
157:     /* Dear future editors:
158:       The pixel height of the iframe containing this page
159:       should equal the sum of height, padding-bottom, and 2x border size
160:       specified in this block, else the bottom border will not be at the
161:       bottom edge of the frame. Now it is based on 325px height for weblead,
162:       and 100px for weblist */
163: 
164:     if (isset ($iframeHeight)) {
165:         $height = $iframeHeight;
166:     } else {
167:         $height = $type == 'weblist' ? 125 : 325;
168:     }
169:     if (isset ($bs)) {
170:         $border = intval(preg_replace('/[^0-9]/', '', $bs));
171:     } else if (isset ($bc)) {
172:         $border = 0;
173:     } else $border = 0;
174:     $padding = 36;
175:     $height = $height - $padding - (2 * $border);
176: 
177:     echo 'border: '. $border .'px solid ';
178:     if (isset ($bc)) echo addslashes ($bc);
179:     echo ";\n";
180: 
181:     ?>
182: 
183:     -moz-border-radius: 3px;
184:     -webkit-border-radius: 3px;
185:     border-radius: 3px;
186:     padding-bottom: <?php echo addslashes ($padding) ."px;\n"?>
187:     height: <?php echo addslashes ($height) ."px;\n"?>
188: }
189: body {
190:     <?php
191:     if (isset ($fg)) {
192:         echo 'color: '. addslashes ($fg) .";\n";
193:     }
194:     if (isset ($bgc)) echo 'background-color: '. addslashes ($bgc) .";\n";
195:     if (isset ($font)) {
196:         echo 'font-family: '. addslashes (FontPickerInput::getFontCss($font)) .";\n";
197:     } else {
198:         echo "font-family: Arial, Helvetica, sans-serif;\n";
199:     }
200:     ?>
201:     font-size:12px;
202: }
203: 
204: input {
205:     border: 1px solid #AAA;
206:     font-family: inherit;
207: }
208: .row {
209:     margin-bottom: 10px;
210: }
211: textarea {
212:     box-sizing: border-box;
213:     width: 100%;
214:     height: 100px;
215:     border-radius: 2px;
216:     font-family: inherit;
217: }
218: input[type="text"] {
219:     box-sizing: border-box;
220:     padding: 2px;
221:     border-radius: 2px;
222:     line-height: 1.5em;
223: }
224: input[type="text"] {
225:     width: 100%;
226: }
227: #contact-header{
228:     color:white;
229:     text-align:center;
230:     font-size: 16px;
231: }
232: #submit {
233:     box-sizing:border-box;
234:     float: right;
235:     margin-top: 7px;
236:     margin-bottom: 5px;
237:     padding: 7px;
238:     border-radius: 2px;
239:     width: 100%;
240:     font-family: inherit;
241: }
242: #submit:hover {
243:     
244: }
245: .submit-button-row {
246:     height: 30px;
247: }
248: <?php
249: 
250: ?>
251: </style>
252: 
253: <?php
254: 
255: ?>
256: </head>
257: <body>
258: 
259: <?php
260: foreach(Yii::app()->user->getFlashes() as $key => $message) {
261:     echo '<div class="flash-' . $key . '">' . $message . "</div>\n";
262: }
263: 
264: $form = $this->beginWidget('CActiveForm', array(
265:     'id'=>$type,
266:     'enableAjaxValidation'=>false,
267:     'htmlOptions'=>array(
268:     ),
269: ));
270: 
271: function renderFields ($fieldList, $type, $form, $model, $contactFields=null) {
272:     foreach($fieldList as $field) {
273:         $fieldName = $field['fieldName'];
274:         if(!isset($field['type']) || $field['type']==='normal'){
275:             if(isset($field['label']) && $field['label'] != '') {
276:                 $label = '<label>' . $field['label'] . '</label>';
277:             } else {
278:                 if($type === 'service' && in_array($field['fieldName'], $contactFields)){
279:                     $contact = clone Contacts::model ();
280:                     if ($model->hasErrors ($fieldName)) {
281:                         $contact->addError ($fieldName, $model->getError ($fieldName));
282:                     }
283:                     $label = $form->labelEx ($contact, $fieldName);
284:                 }else{
285:                     $label = $form->labelEx($model,$field['fieldName']);
286:                 }
287:             }
288: 
289:             // label already has a '*' to indicate it is required
290:             $starred = strpos($label, '*') !== false;
291:             ?>
292:             <div class="row">
293:                 <?php
294:                 echo $label;
295:                 echo ($field['required'] && !$starred ? 
296:                     '<span class="asterisk"> *</span>' : '');
297:                 if($field['position'] == 'top') { ?>
298:                     <br />
299:                 <?php
300:                 }
301:             echo $form->error($model, $field['fieldName']);
302: 
303:             if($type === 'service' && in_array($field['fieldName'], $contactFields)){ 
304:                 echo CHtml::tag ('input', array (
305:                     'type' => 'text',
306:                     'name' => 'Services['.$field['fieldName'].']',
307:                     'class' => $model->hasErrors ($field['fieldName']) ? 'error' : '',
308:                     'value' => isset ($_POST['Services'][$field['fieldName']]) ?
309:                         $_POST['Services'][$field['fieldName']] : '',
310:                 ));
311:             } else {
312:                 
313:                     echo $model->renderInput($field['fieldName']);
314:                 
315:             } ?>
316:             </div>
317: <?php
318:         }elseif ($field['type'] === 'tags') {
319:             ?>
320:             <input type="hidden" name="tags" value="<?php echo $field['label']?>" />
321:             <?php
322:         }elseif ($field['type'] === 'hidden') {
323:             $model->{$field['fieldName']}=$field['label'];
324:             echo $form->hiddenField($model, $field['fieldName']);
325:         }
326:     }
327: }
328: 
329: renderFields ($fieldList, $type, $form, $model, $contactFields);
330: 
331: 
332: 
333: ?>
334: <div class="submit-button-row row">
335: <?php
336: echo CHtml::submitButton(Yii::t('app','Submit'),array('id'=>'submit'));
337: ?>
338: </div>
339: 
340: <?php
341: $this->endWidget();
342: ?>
343: 
344: <script>
345: (function () {
346:     // prevent duplicate submissions
347:     $('form').submit (function () {
348:         $(this).find ('#submit').attr ('disabled', 'disabled');
349:     });
350: }) ();
351: 
352: <?php
353: 
354: 
355: ?>
356: </script>
357: 
358: </body>
359: </html>
360: 
X2CRM Documentation API documentation generated by ApiGen 2.8.0