?> </h4> <p class='fieldhelp' style="width:auto"><?php echo Yii::t('marketing', 'Copy and paste this code into your website to include the web lead form.'); ?> </p> <div id='embed-row'> <span class='x2-button highlight' id='generate'><?php echo Yii::t('marketing', 'Generate HTML & Save'); ?> </span> <i class='fa fa-long-arrow-right'></i> <input readonly type='text' id="embedcode" /><span class='x2-button' id='clipboard' title='Select Text'><i class='fa fa-clipboard'></i></span><span style='display:none'id='copy-help'><p class='fieldhelp'> <?php $help = Auxlib::isMac() ? "⌘-c to copy" : "ctrl-c to copy"; ?> <?php echo Yii::t('app', $help); ?> </p></span> </div> </div> </div> <?php echo X2Html::divider('650px', '5px'); ?> <h4><?php echo Yii::t('marketing', 'Additional Settings');
/** * Registers a set of css files which are used for all pages with the main layout. */ private function registerCombinedCss() { $ieVer = Auxlib::getIEVer(); $cssUrl = $this->getThemeUrl() . '/css'; $cssFiles = array('screen.css', 'auxlib.css', 'jquery-ui.css', 'dragtable.css', 'main.css', 'ui-elements.css', 'layout.css', 'details.css', 'x2forms.css', 'form.css', 'publisher.css', 'sortableWidgets.css', '../../../js/qtip/jquery.qtip.min.css', '../../../js/checklistDropdown/jquery.multiselect.css', 'rating/jquery.rating.css', 'fontAwesome/css/font-awesome.css', 'bootstrap/bootstrap.css', 'css-loaders/load8.css'); $cssFiles[] = 'recordView.css'; $responsiveCssFiles = array('responsiveLayout.css', 'responsiveUIElements.css', 'responsiveX2Forms.css'); $this->registerResponsiveTitleBarCss(); $this->registerCssFiles('combinedCss', $cssFiles, 'screen, projection'); if (RESPONSIVE_LAYOUT) { $this->registerCssFiles('responsiveCombinedCss', $responsiveCssFiles, 'screen, projection'); } }
public static function logo($type, array $htmlOptions = array()) { assert(in_array($type, array('mobile', 'menu', 'login_white', 'login_black', 'about'))); $logoName = $type . '_logo'; $html = ''; if (in_array($type, array('menu')) && Auxlib::isIE8() || in_array($type, array('login_white', 'login_black', 'mobile')) && Auxlib::isIE()) { $htmlOptions = self::mergeHtmlOptions(array('class' => $logoName), $htmlOptions); $filename = $logoName . '.png'; $html .= CHtml::image(Yii::app()->request->baseUrl . '/images/' . $filename, Yii::app()->settings->appName, $htmlOptions); } else { $htmlOptions = self::mergeHtmlOptions(array('class' => 'icon-x2-logo-square ' . $logoName), $htmlOptions); $html .= CHtml::tag('span', $htmlOptions, ' '); } return $html; }
<i class='fa fa-bars'></i> <!-- <div class='x2-bar'></div> --> <!-- <div class='x2-bar'></div> --> <!-- <div class='x2-bar'></div> --> </div> <a href="<?php echo $isGuest ? $this->createUrl('/site/login') : $this->createUrl('/profile/view', array('id' => Yii::app()->user->getId())); ?> " id='search-bar-title' class='special'> <?php $custom = Yii::app()->params->logo !== 'uploads/logos/yourlogohere.png'; if ($custom) { echo CHtml::image(Yii::app()->request->baseUrl . '/' . Yii::app()->params->logo, Yii::app()->settings->appName, array('id' => 'your-logo', 'class' => 'custom-logo')); } else { if (Auxlib::isIE()) { echo CHtml::image(Yii::app()->request->baseUrl . '/images/x2-logo-square.png', Yii::app()->settings->appName, array('id' => 'your-logo', 'class' => 'custom-logo')); } else { echo CHtml::tag('span', array('id' => 'x2-logo', 'class' => 'icon-x2-logo-square'), ' '); } } ?> </a> <div id='top-menus-container'> <div id='top-menus-container-inner'> <?php //render main menu items $this->widget('zii.widgets.CMenu', array('id' => 'main-menu', 'encodeLabel' => false, 'htmlOptions' => array('class' => 'main-menu'), 'items' => $menuItems)); //render user menu items if logged in if (!$isGuest) { ?>
/** * Upload a file. */ public function actionUpload() { if (!isset($_FILES['upload'])) { throw new CHttpException('400', 'Invalid request.'); } if (isset($_POST['drive']) && $_POST['drive']) { // google drive $auth = new GoogleAuthenticator(); if ($auth->getAccessToken()) { $service = $auth->getDriveService(); } $createdFile = null; if (isset($service, $_SESSION['access_token'], $_FILES['upload'])) { try { $file = new Google_DriveFile(); $file->setTitle($_FILES['upload']['name']); $file->setDescription('Uploaded by X2Engine'); $file->setMimeType($_FILES['upload']['type']); if (empty($_FILES['upload']['tmp_name'])) { $err = false; switch ($_FILES['newfile']['error']) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: $err .= 'File size exceeds limit of ' . get_max_upload() . ' bytes.'; break; case UPLOAD_ERR_PARTIAL: $err .= 'File upload was not completed.'; break; case UPLOAD_ERR_NO_FILE: $err .= 'Zero-length file uploaded.'; break; default: $err .= 'Internal error ' . $_FILES['newfile']['error']; break; } if ((bool) $message) { throw new CException($message); } } $data = file_get_contents($_FILES['upload']['tmp_name']); $createdFile = $service->files->insert($file, array('data' => $data, 'mimeType' => $_FILES['upload']['type'])); if (is_array($createdFile)) { $model = new Media(); $model->fileName = $createdFile['id']; $model->name = $createdFile['title']; if (isset($_POST['associationId'])) { $model->associationId = $_POST['associationId']; } if (isset($_POST['associationType'])) { $model->associationType = $_POST['associationType']; } if (isset($_POST['private'])) { $model->private = $_POST['private']; } $model->uploadedBy = Yii::app()->user->getName(); $model->mimetype = $createdFile['mimeType']; $model->filesize = $createdFile['fileSize']; $model->drive = 1; $model->save(); if ($model->associationType == 'feed') { $event = new Events(); $event->user = Yii::app()->user->getName(); if (isset($_POST['attachmentText']) && !empty($_POST['attachmentText'])) { $event->text = $_POST['attachmentText']; } else { $event->text = Yii::t('app', 'Attached file: '); } $event->type = 'media'; $event->timestamp = time(); $event->lastUpdated = time(); $event->associationId = $model->id; $event->associationType = 'Media'; $event->save(); if (Auxlib::isAjax()) { return print "success"; } $this->redirect(array('/profile/view', 'id' => Yii::app()->user->getId())); } elseif ($model->associationType == 'docs') { if (Auxlib::isAjax()) { return print "success"; } $this->redirect(array('/docs/docs/index')); } elseif (!empty($model->associationType) && !empty($model->associationId)) { $note = new Actions(); $note->createDate = time(); $note->dueDate = time(); $note->completeDate = time(); $note->complete = 'Yes'; $note->visibility = '1'; $note->completedBy = Yii::app()->user->getName(); if ($model->private) { $note->assignedTo = Yii::app()->user->getName(); $note->visibility = '0'; } else { $note->assignedTo = 'Anyone'; } $note->type = 'attachment'; $note->associationId = $_POST['associationId']; $note->associationType = $_POST['associationType']; $association = $this->getAssociation($note->associationType, $note->associationId); if ($association != null) { $note->associationName = $association->name; } $note->actionDescription = $model->fileName . ':' . $model->id; if ($note->save()) { if (Auxlib::isAjax()) { return print "success"; } $this->redirect(array($model->associationType . '/' . $model->associationId)); } } else { if (Auxlib::isAjax()) { return print "success"; } $this->redirect('/media/media/view', array('id' => $model->id)); } } else { throw new CHttpException('400', 'Invalid request.'); } } catch (Google_AuthException $e) { $auth->flushCredentials(); $auth->setErrors($e->getMessage()); $service = null; $createdFile = null; } } else { if (isset($_SERVER['HTTP_REFERER'])) { if (Auxlib::isAjax()) { return print "success"; } $this->redirect($_SERVER['HTTP_REFERER']); } else { throw new CHttpException('400', 'Invalid request'); } } } else { // non-google drive upload $model = new Media(); $temp = CUploadedFile::getInstanceByName('upload'); // file uploaded through form if ($temp && ($tempName = $temp->getTempName()) && !empty($tempName)) { $name = $temp->getName(); $name = str_replace(' ', '_', $name); $check = Media::model()->findAllByAttributes(array('fileName' => $name)); // rename file if there name conflicts by suffixing "(n)" if (count($check) != 0) { $count = 1; $newName = $name; $arr = explode('.', $name); $name = $arr[0]; while (count($check) != 0) { $newName = $name . '(' . $count . ').' . $temp->getExtensionName(); $check = Media::model()->findAllByAttributes(array('fileName' => $newName)); $count++; } $name = $newName; } $username = Yii::app()->user->name; // copy file to user's media uploads directory if (FileUtil::ccopy($tempName, "uploads/protected/media/{$username}/{$name}")) { if (isset($_POST['associationId'])) { $model->associationId = $_POST['associationId']; } if (isset($_POST['associationType'])) { $model->associationType = $_POST['associationType']; } if (isset($_POST['private'])) { $model->private = true; } $model->uploadedBy = Yii::app()->user->getName(); $model->createDate = time(); $model->lastUpdated = time(); $model->fileName = $name; $model->mimetype = $temp->type; if (!$model->save()) { $errors = $model->getErrors(); $error = ArrayUtil::pop(ArrayUtil::pop($errors)); Yii::app()->user->setFlash('top-error', Yii::t('app', 'Attachment failed. ' . $error)); if (Auxlib::isAjax()) { return print "success"; } $this->redirect(array($model->associationType . '/' . $model->associationType . '/view', 'id' => $model->associationId)); Yii::app()->end(); } else { $relatedModel = X2Model::getModelOfTypeWithId($model->associationType, $model->associationId); if ($relatedModel && $relatedModel->supportsRelationships) { $rel = new Relationships(); $rel->setFirstModel($model); $rel->setSecondModel($relatedModel); $rel->save(); } } // handle different upload types switch ($model->associationType) { case 'feed': $this->handleFeedTypeUpload($model, $name); break; case 'docs': if (Auxlib::isAjax()) { return print "success"; } $this->redirect(array('/docs/docs/index')); break; case 'loginSound': case 'notificationSound': if (Auxlib::isAjax()) { return print "success"; } $this->redirect(array('/profile/settings', 'id' => Yii::app()->user->getId())); break; case 'bg': case 'bg-private': $this->redirect(array('/profile/settings', 'bgId' => $model->id)); break; case 'none': if (Auxlib::isAjax()) { return print "success"; } break; case 'topicReply': $this->handleTopicReplyUpload($model, $name); break; default: $this->handleDefaultUpload($model, $name); break; } } } else { if (isset($_SERVER['HTTP_REFERER'])) { if (Auxlib::isAjax()) { return print "success"; } $this->redirect($_SERVER['HTTP_REFERER']); } else { throw new CHttpException('400', 'Invalid request'); } } if (isset($_GET['redirect'])) { $this->redirect($_SERVER['HTTP_REFERER']); } } }