Пример #1
0
	public function htmlcomp($id){

		$app = new Apps();
		
		$query_q = 'SELECT * FROM cms_content WHERE id = "'.$id.'"';
		$query_r = mysql_query($query_q);
		$query = mysql_fetch_array($query_r);
		return $app->html(stripslashes($query['html']));			
	}
Пример #2
0
 public static function initialize($idA, $idS)
 {
     $OA = AppsPeer::retrieveByPK($idA);
     if (!$OA instanceof Apps) {
         $OA = new Apps();
         $OA->setSiteId($idS);
         $OA->setActiu(true);
     }
     return new AppsForm($ON, array('IDS' => $idS));
 }
Пример #3
0
 public function saveSettings()
 {
     $eqApp = new Apps();
     if ($_POST['name']) {
         $check_q = "SELECT * FROM crm_settings";
         $check_r = mysql_query($check_q);
         if (mysql_num_rows($check_r) == 0) {
             $eqApp->insertSql("crm_settings");
         } else {
             $eqApp->udpdateSql("crm_settings");
         }
     }
 }
Пример #4
0
 public function update()
 {
     //add or update company
     if (isset($_POST['name'])) {
         $eqapp = new Apps();
         $check_q = "SELECT * FROM settings";
         $check_r = mysql_query($check_q);
         if (mysql_num_rows($check_r) == 0) {
             //if a row doesnt exist, then add a row
             $eqapp->insertSql("settings");
         } else {
             //if a row does exist then update it
             $eqapp->udpdateSql("settings");
         }
     }
 }
Пример #5
0
 /**
  * 	Function to save user by POST values
  */
 public function saveUser()
 {
     $eqApp = new Apps();
     //ajax function that saves a user
     if (isset($_POST['fname'])) {
         //create JSON header
         header('Content-type: application/json');
         //in case they change their email... check if that email already exists
         $checkEmail_q = 'SELECT * FROM crm_users WHERE email = "' . $_POST['email'] . '" AND id <> "' . $_POST['id'] . '"';
         $checkEmail_r = mysql_query($checkEmail_q);
         if (mysql_num_rows($checkEmail_r) > 0) {
             //if email exists return fail JSON object
             echo '{ "message": "fail" }';
         } else {
             if (isset($_SESSION['x_equi'])) {
                 //save and overwrite current session objects
                 $_SESSION['x_equi'] = $_POST['email'];
                 $_SESSION['x_equi_status'] = $_POST['status'];
                 $_SESSION['x_equi_name'] = $_POST['fname'] . ' ' . $_POST['lname'];
                 $_SESSION['x_equi_fname'] = $_POST['fname'];
                 $eqApp->udpdateSql("crm_users");
                 echo '{ "message": "success" }';
             }
         }
         exit;
     } else {
         header('location: ' . _EQROOT_);
     }
 }
 public function edit($id)
 {
     if (isset($_POST['name'])) {
         $eqapp = new Apps();
         $eqapp->udpdateSql("cms_plugins");
         header('Location:' . _EQROOT_ . 'cms_plugins/edit/' . $_POST['id']);
     } else {
         $query_q = 'SELECT * FROM cms_plugins 
                     WHERE 
                     id = "' . $id . '"';
         $query = mysql_query($query_q);
         if (mysql_num_rows($query) == 0) {
             header('Location:' . _EQROOT_ . 'cms_plugins');
         }
         $row = mysql_fetch_array($query);
         return $row;
     }
 }
Пример #7
0
 public function loadHeader()
 {
     global $compS;
     global $pageSett;
     global $equrl;
     if (count($equrl) > 1) {
         $thispage = $equrl[0];
         $a = array();
         $b = 0;
         foreach ($equrl as $r) {
             if ($b > 0) {
                 $a[] = $r;
             }
             $b++;
         }
         $customUrl = implode('/', $a);
         $customUrl = rtrim($customUrl, '/');
         $getCustUrl_q = 'SELECT * FROM cms_content WHERE custom_url LIKE "' . $customUrl . '"';
         $getCustUrl_r = mysql_query($getCustUrl_q);
         if (mysql_num_rows($getCustUrl_r)) {
             $custPathUrl_f = mysql_fetch_array($getCustUrl_r);
             $pageSett['custom_title'] = $custPathUrl_f['name'];
             $custPathUrl = $custPathUrl_f['name'] . ' - ';
             $_GET[$custPathUrl_f['recordset']] = $custPathUrl_f['id'];
         } else {
             Apps::redirect(_SITEROOT_ . $thispage);
         }
     }
     if (isset($pageSett['id'])) {
         if (isset($custPathUrl)) {
             $pageTitle = $pageSett['meta_title'] ? $custPathUrl . ' ' . $pageSett['meta_title'] . ' | ' . $compS['name'] : $custPathUrl . ' ' . $pageSett['title'] . ' | ' . $compS['name'];
         } else {
             $pageTitle = $pageSett['meta_title'] ? $pageSett['meta_title'] . ' | ' . $compS['name'] : $pageSett['title'] . ' | ' . $compS['name'];
         }
     } else {
         $pageTitle = "404 | " . $compS['name'];
     }
     $html = "<!DOCTYPE html>\n";
     $html .= "<!--[if (gte IE 9)|!(IE)]><!--><html lang=\"en\"> <!--<![endif]-->\n";
     $html .= "<head>\n";
     $html .= "<meta charset=\"utf-8\">\n";
     $html .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n";
     $html .= "<title>" . $pageTitle . "</title>\n";
     $html .= "<meta name=\"keywords\" content=\"" . (!empty($pageSett['meta_keywords']) ? $pageSett['meta_keywords'] : $compS['meta_keywords']) . "\">\n";
     $html .= "<meta name=\"description\" content=\"" . (!empty($pageSett['meta_description']) ? $pageSett['meta_description'] : $compS['meta_description']) . "\">\n";
     $html .= "<meta name=\"robots\" content=\"index," . (!empty($pageSett['search_index']) && $pageSett['search_index'] == "yes" ? "follow" : "nofollow") . "\" />\n";
     echo $html;
 }
Пример #8
0
 public function appList($id, $offset = 0)
 {
     $user_app_list = $this->findAll(array('condition' => 'user_id=' . $id, 'select' => 'app_id', 'order' => 'added DESC', 'limit' => Yii::app()->params->maxAppsPerRequest, 'offset' => $offset));
     $uappids = array();
     if (empty($user_app_list)) {
         $cond = '0';
     } else {
         foreach ($user_app_list as $v) {
             $uappids[] = $v->app_id;
         }
         $cond = implode(' OR id=', $uappids);
     }
     $ua = Apps::model()->findAll(array('condition' => 'id=' . $cond, 'order' => 'users DESC'));
     $ua2 = array();
     foreach ($ua as $v) {
         $ua2[$v->id] = $v;
     }
     $userapps = array();
     foreach ($user_app_list as $v) {
         $userapps[] = $ua2[$v->app_id];
     }
     return $userapps;
 }
Пример #9
0
 public function method()
 {
     if ($this->request->server['REQUEST_METHOD'] == 'POST') {
         $type = $this->request->post['type'];
         if (!in_array($type, array('payment', 'shipping'))) {
             $type = 'shipping';
         }
         $this->data['info'] = Language::getVar('SUMO_CATALOG_' . strtoupper($type) . '_METHODS');
         $this->data['type'] = $type;
         $apps = Apps::getAvailable($this->config->get('store_id'), $type == 'shipping' ? 1 : 2);
         // Unset old methods
         unset($this->session->data[$type . '_methods']);
         foreach ($apps as $list) {
             $file = DIR_HOME . 'apps/' . $list['list_name'] . '/catalog/controller/checkout.php';
             if (file_exists($file)) {
                 include $file;
                 $class = ucfirst($list['list_name']) . '\\Controller' . ucfirst($list['list_name']) . 'Checkout';
                 $class = new $class($this->registry);
                 $list['options'] = $class->{$type}();
             }
             $this->session->data[$type . '_methods'][$list['list_name']] = $list;
         }
         $this->data['warning'] = '';
         if (empty($this->session->data[$type . '_methods'])) {
             $this->data['warning'] = Language::getVar('SUMO_NOUN_' . strtoupper($type) . '_ERROR_NONE_AVAILABLE', $this->url->link('information/contact', '', 'SSL'));
         }
         if (isset($this->session->data[$type . '_methods'])) {
             $this->data['methods'] = $this->session->data[$type . '_methods'];
         }
         if ($type == 'shipping') {
             $this->session->data['force_step'] = 5;
         } else {
             $this->session->data['force_step'] = 6;
         }
         $this->template = 'checkout/method.tpl';
         $this->response->setOutput($this->render());
     } else {
         $this->response->setOutput(json_encode(array()));
     }
 }
Пример #10
0
 /**
  * Declares an association between this object and a Apps object.
  *
  * @param      Apps $v
  * @return     UsuarisApps The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setApps(Apps $v = null)
 {
     if ($v === null) {
         $this->setAppId(NULL);
     } else {
         $this->setAppId($v->getAppId());
     }
     $this->aApps = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Apps object, it will not be re-added.
     if ($v !== null) {
         $v->addUsuarisApps($this);
     }
     return $this;
 }
Пример #11
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Apps the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Apps::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function removerecordfile($id, $recordname, $filename)
 {
     $query_q = 'UPDATE cms_content SET ' . $recordname . ' = "" WHERE id = "' . $id . '"';
     $query_r = mysql_query($query_q);
     $eqApp = new Apps();
     foreach (glob('resources/uploads/' . $id . '/' . $recordname . '/*') as $file) {
         if (is_dir($file)) {
             recursiveRemoveDirectory($file);
         } else {
             unlink($file);
         }
     }
     $eqApp->rrmdir('resources/uploads/' . $id . '/' . $recordname);
     exit;
 }
Пример #13
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Apps $value A Apps object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(Apps $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getAppId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Пример #14
0
 public function actionLoadMore($id)
 {
     if (Yii::app()->request->isAjaxRequest) {
         $lastOffset = Yii::app()->getRequest()->getPost('lastOffset');
         $list = Yii::app()->getRequest()->getPost('list');
         if ($list == 'all') {
             $apps = Apps::model()->appList($lastOffset);
         } else {
             $apps = UserApps::model()->appList($id, $lastOffset);
         }
         $user_apps_ids = UserApps::model()->userAppIds($id);
         $res = $this->renderPartial('_appTable', array('apps' => $apps, 'user_apps_ids' => $user_apps_ids, $display = 'none'), true);
         $lastOffset += Yii::app()->params->maxAppsPerRequest;
         echo json_encode(array('status' => 'ok', 'offset' => $lastOffset, 'data' => $res));
     } else {
         throw new CException('Not Found', 404);
     }
 }
Пример #15
0
 private function display($store_id)
 {
     $this->data['widgets'] = Apps::getAvailable($store_id, 3);
     $this->template = 'settings/themes/builder/display.tpl';
     return $this->render();
 }
Пример #16
0
    function generateTableBody($pluginId, $structureId, $recordId = NULL)
    {
        $structureInfo = PluginListBuilder::singleStrucArray($structureId);
        $recordArray = PluginListBuilder::strucRecordArray($structureId);
        //begin with building the columns and get the user set columns
        $listFields = explode(',', $structureInfo['listfields']);
        $listFields = PluginListBuilder::validateRecordViaFieldset($listFields, $recordArray['fieldsetId']);
        $listSearch = explode(',', $structureInfo['listsearch']);
        $listSearch = PluginListBuilder::validateRecordViaFieldset($listSearch, $recordArray['fieldsetId']);
        if (!empty($_GET['search' . $structureInfo['db_name']]) && empty($listSearch)) {
            echo 'Search settings not set up...please notify developer';
        }
        $query_q = 'SELECT * FROM cms_content 
					WHERE
					pluginid = "' . $pluginId . '"
					AND recordset = "' . $structureInfo['db_name'] . '"';
        //SEARCH PARAMETERS
        if (!empty($recordId)) {
            $query_q .= ' AND recordid = "' . $recordId . '"';
        }
        if (!empty($_GET['search' . $structureInfo['db_name']]) && !empty($listSearch)) {
            $query_q .= ' AND (';
            $g = 1;
            foreach ($listSearch as $search) {
                $query_q .= $search . ' LIKE "%' . $_GET['search' . $structureInfo['db_name']] . '%"';
                if ($g < count($listSearch)) {
                    $query_q .= ' OR ';
                }
                $g++;
            }
            $query_q .= ')';
        }
        $query_q .= ' ORDER BY ' . ($structureInfo['listorder'] ? $structureInfo['listorder'] : 'id ASC');
        $query_q;
        $query_r = mysql_query($query_q) or die(mysql_error());
        $ptml = '<tbody>';
        while ($query = mysql_fetch_array($query_r)) {
            $ptml .= '<tr>';
            if (count($listFields)) {
                $n = 0;
                foreach ($listFields as $arr) {
                    if ($recordArray[$arr]['type'] == "foreignkey") {
                        $recordOptions = Apps::get_field_options($recordArray[$arr]['options'], $n);
                        ///IF IT IS FOREGIN KEY DO THE WORK
                        $fkeyval = explode(",", $recordOptions['record_fkeyvalue']);
                        $fkeyopt = explode(",", $recordOptions['record_fkeyoptions']);
                        if ($recordOptions['record_fkeyvalue']) {
                            $fetchKeys_q = 'SELECT * FROM cms_content WHERE ' . $recordOptions['record_fkeyvalue'] . ' = "' . $query[$arr] . '"';
                        } else {
                            $fetchKeys_q = 'SELECT * FROM cms_content WHERE id = "' . $query[$arr] . '"';
                        }
                        $fetchKeys_r = mysql_query($fetchKeys_q);
                        $fetchKeys = mysql_fetch_array($fetchKeys_r);
                        if (count($fkeyopt)) {
                            $countfkey = 0;
                            foreach ($fkeyopt as $name) {
                                $recordDisplayVal = ($countfkey > 0 ? " - " : "") . $fetchKeys[$name];
                                $countfkey++;
                            }
                        } else {
                            $recordDisplayVal = $fetchKeys['id'];
                        }
                    } else {
                        $recordDisplayVal = $query[$arr];
                    }
                    $ptml .= '<td align="center">' . ($n == 0 ? '<a href="' . _EQROOT_ . 'plugins/edit/' . $pluginId . '?id=' . $query['id'] . '&psid=' . $structureId . '">' : '') . ($recordArray[$arr]['type'] == 'photo' ? '<img src="' . (!empty($query[$arr]) ? _UPLOADS_ . $query['id'] . '/' . $recordArray[$arr]['db_name'] . '/300xauto_' : _EQROOT_ . 'public/images/no-image.jpg') : '') . $recordDisplayVal . ($recordArray[$arr]['type'] == 'photo' ? '" width="200">' : '') . ($n == 0 ? '</a>' : '') . '</td>';
                    $n++;
                }
            } else {
                $ptml .= '<th>Id #</th>';
            }
            $ptml .= '</tr>';
        }
        $ptml .= '</tbody>';
        $ptml .= '</table>';
        return $ptml;
    }
Пример #17
0
 public function deleterecord($id)
 {
     $eqApp = new Apps();
     $checkRec_q = 'SELECT * FROM cms_content 
                    WHERE 
                    id = "' . $id . '"';
     $checkRec_r = mysql_query($checkRec_q);
     if (mysql_num_rows($checkRec_r) > 0) {
         $deleteR_q = 'DELETE FROM cms_content 
                       WHERE 
                       id = "' . $id . '"';
         $deleteR_r = mysql_query($deleteR_q);
         //if there exists a folder for this record delete it and its contents as well using rrmdir()
         if (file_exists('../uploads/' . $id . '/')) {
             $eqApp->rrmdir('../uploads/' . $id . '/');
         }
         header('location:' . _EQROOT_ . 'plugins/view/' . $_GET['pid']);
     } else {
         header('location:' . _EQROOT_);
     }
 }
Пример #18
0
 public function editcat($id)
 {
     $eqApp = new Apps();
     if (isset($_POST['name'])) {
         header('Content-type: application/json');
         $getCat_q = 'SELECT * FROM crm_contacts_cats 
                      WHERE 
                      name = "' . $_POST['name'] . '" 
                      AND id <> "' . $_POST['id'] . '"';
         $getCat_r = mysql_query($getCat_q);
         if (mysql_num_rows($getCat_r) > 0) {
             echo '{ "message": "error" }';
         } else {
             $eqApp->udpdateSql("crm_contacts_cats");
             echo '{ "message": "success" , "id": "' . $_POST['id'] . '"  }';
         }
         exit;
     } else {
         $query_q = 'SELECT * FROM
                     crm_contacts_cats 
                     WHERE id = "' . $id . '" ';
         $query = mysql_query($query_q);
         if (mysql_num_rows($query) == 0) {
             header('Location:' . _EQROOT_ . 'contacts/cats');
         }
         $row = mysql_fetch_array($query);
         return $row;
     }
 }
Пример #19
0
 public function getMethods()
 {
     $json = array('' => array('name' => Language::getVar('SUMO_NOUN_SELECT')));
     $app_id = 0;
     if (isset($this->request->get['store_id']) && !empty($this->request->get['method'])) {
         if (isset($this->request->get['order_id'])) {
             $this->load->model('sale/orders');
             $check = $this->model_sale_orders->getOrder($this->request->get['order_id']);
         }
         $apps = Apps::getAvailable($this->request->get['store_id'], $this->request->get['method']);
         $this->config->set('store_id', $this->request->get['store_id']);
         $this->config->set('is_admin', true);
         if ($this->request->get['method'] == 1) {
             $type = 'shipping';
         } else {
             $type = 'payment';
         }
         $app_id = $check[$type]['app']['id'];
         foreach ($apps as $list) {
             $file = DIR_HOME . 'apps/' . $list['list_name'] . '/catalog/controller/checkout.php';
             if (file_exists($file)) {
                 include $file;
                 $class = ucfirst($list['list_name']) . '\\Controller' . ucfirst($list['list_name']) . 'Checkout';
                 $class = new $class($this->registry);
                 $list['options'] = $class->{$type}();
             }
             if (empty($list['options'])) {
                 continue;
             }
             if ($list['id'] == $app_id) {
                 $list['selected'] = true;
             }
             $json[$list['list_name']] = $list;
         }
     }
     $this->response->setOutput(json_encode($json));
 }
Пример #20
0
 public function rrmdir($dir)
 {
     $eqApp = new Apps();
     if (is_dir($dir)) {
         $objects = scandir($dir);
         foreach ($objects as $object) {
             if ($object != "." && $object != "..") {
                 if (filetype($dir . "/" . $object) == "dir") {
                     $eqApp->rrmdir($dir . "/" . $object);
                 } else {
                     unlink($dir . "/" . $object);
                 }
             }
         }
         reset($objects);
         rmdir($dir);
     }
 }
Пример #21
0
 public function formBody($plugstrucid, $fieldsetId, $id = NULL)
 {
     if (isset($id)) {
         $current_q = 'SELECT * FROM cms_content 
                       WHERE
                       id = "' . $id . '"';
         $current_r = mysql_query($current_q);
         $current = mysql_fetch_array($current_r);
     }
     $pstruc_q = 'SELECT * FROM cms_plugin_structure 
                  WHERE 
                  id = "' . $plugstrucid . '"';
     $pstruc_r = mysql_query($pstruc_q);
     $pstruc = mysql_fetch_array($pstruc_r);
     $records_q = 'SELECT * FROM cms_records 
     			  WHERE 
     			  fieldsetid = "' . $fieldsetId . '" 
     			  ORDER BY sortorder ASC';
     $records_r = mysql_query($records_q);
     $x = 0;
     $znum = 0;
     $formBody = '';
     while ($records = mysql_fetch_array($records_r)) {
         $x++;
         $znum++;
         $recordOptions = Apps::get_field_options($records['options'], $znum);
         $elementNameId = $pstruc['db_name'] . '_' . $records['db_name'];
         $formBody .= "<div class=\"rowElem" . ($x == 1 ? ' noborder' : '') . "\">\n";
         $formBody .= "<label>" . $records['name'] . ($recordOptions['record_required'] == 'true' ? '* ' : '') . ": " . (!empty($records['helper']) ? '<a onclick="$.jGrowl(\'' . $records['helper'] . '\');">&nbsp;&nbsp;<i class="fa fa-question-circle fa-1x"></i></a>' : '') . "</label>\n";
         $formBody .= "<div class=\"formRight\">\n";
         switch ($records['type']) {
             case "text":
                 $formBody .= "<input value=\"" . $current[$records['db_name']] . "\" " . "type=\"text\" " . "name=\"" . $elementNameId . "\" " . "id=\"" . $elementNameId . "\" " . "class=\"validate[" . ($recordOptions['record_required'] == 'true' ? 'required' : 'optional') . ($recordOptions['record_email'] == 'true' ? ',custom[email]' : '') . "]\" " . "style=\"" . $recordOptions['record_styles'] . "\"/>\n";
                 break;
             case "number":
                 $formBody .= "<input value=\"" . $current[$records['db_name']] . "\" " . "type=\"text\" name=\"" . $elementNameId . "\" " . "id=\"" . $elementNameId . "\" " . "style=\"" . $recordOptions['record_styles'] . "\" " . "class=\"validate[" . ($recordOptions['record_required'] == 'true' ? 'required' : 'optional') . ",custom[number]]\" " . "style=\"" . $recordOptions['record_styles'] . "\"/>";
                 break;
             case "email":
                 $formBody .= "<input value=\"" . $current[$records['db_name']] . "\" " . "type=\"text\" name=\"" . $elementNameId . "\" " . "id=\"" . $elementNameId . "\" " . "style=\"" . $recordOptions['record_styles'] . "\" " . "class=\"validate[" . ($recordOptions['record_required'] == 'true' ? 'required' : 'optional') . ",custom[email]]\" " . "style=\"" . $recordOptions['record_styles'] . "\"/>\n";
                 break;
             case "html":
                 $formBody .= "<textarea " . "class=\"tinymce validate[" . ($recordOptions['record_required'] == 'true' ? 'required' : 'optional') . "]\" " . "name=\"" . $elementNameId . "\" " . "id=\"" . $elementNameId . "\">" . stripslashes($current[$records['db_name']]) . "</textarea>\n";
                 break;
             case "textarea":
                 $formBody .= "<textarea " . "name=\"" . $elementNameId . "\" " . "id=\"" . $elementNameId . "\" " . "rows=\"10\" " . "class=\"validate[" . ($recordOptions['record_required'] == 'true' ? 'required' : 'optional') . "]\" " . "style=\"" . $recordOptions['record_styles'] . "\">" . $current[$records['db_name']] . "</textarea>\n";
                 break;
             case "select":
             case "multiselect":
                 $formBody .= "<select name=\"" . $elementNameId . ($records['type'] == 'multiselect' ? '[]' : '') . "\" " . "id=\"" . $elementNameId . ($records['type'] == 'multiselect' ? '[]' : '') . "\" " . "class=\"validate[" . ($recordOptions['record_required'] == 'true' ? 'required' : 'optional') . "]\" ";
                 switch ($records['type']) {
                     case 'multiselect':
                         $formBody .= "multiple=\"multiple\" ";
                         break;
                 }
                 $formBody .= "style=\"" . $recordOptions['record_styles'] . "\">";
                 for ($d = 0; $d < count($recordOptions['record_select_vals']); $d++) {
                     // echo $recordOptions['record_select_vals'][$d] . '\b/',$current[$records['db_name']];
                     $formBody .= "\n<option value=\"" . $recordOptions['record_select_vals'][$d] . "\"" . ($recordOptions['record_select_vals'][$d] == $current[$records['db_name']] ? ' selected' : '') . ">" . $recordOptions['record_select_vals'][$d] . "</option>";
                 }
                 $formBody .= "\n</select>\n";
                 break;
             case "yesno":
                 $formBody .= "<input type=\"radio\" id=\"" . $elementNameId . "1\" name=\"" . $elementNameId . "\" checked=\"checked\" value=\"yes\" />\n" . "<label for=\"" . $elementNameId . "1\">Yes</label>\n";
                 $formBody .= "<input type=\"radio\" id=\"" . $elementNameId . "2\" name=\"" . $elementNameId . "\" value=\"no\"/>\n" . "<label for=\"" . $elementNameId . "2\">No</label>\n";
                 break;
             case "checkboxes":
                 $checkArr = explode(',', $current[$records['db_name']]);
                 for ($d = 0; $d < count($recordOptions['record_select_vals']); $d++) {
                     $formBody .= "<input type=\"checkbox\" " . "class=\"validate[" . ($recordOptions['record_required'] == 'true' ? 'required' : 'optional') . "]\" " . "id=\"" . $elementNameId . $d . "\" name=\"" . $elementNameId . "[]\" " . (preg_match('/\\b' . $recordOptions['record_select_vals'][$d] . '\\b/', $current[$records['db_name']]) ? 'checked ' : '') . "value=\"" . $recordOptions['record_select_vals'][$d] . "\" />\n" . "<label for=\"" . $elementNameId . $d . "\">" . $recordOptions['record_select_vals'][$d] . "</label>\n";
                 }
                 break;
             case "radio":
                 for ($d = 0; $d < count($recordOptions['record_select_vals']); $d++) {
                     $formBody .= "<input type=\"radio\" class=\"validate[" . ($recordOptions['record_select_vals'][$d] == 'true' ? 'required' : 'optional') . "]\" id=\"" . $elementNameId . $d . "\" name=\"" . $elementNameId . "\" " . (preg_match('/\\b' . $recordOptions['record_select_vals'][$d] . '\\b/', $current[$records['db_name']]) ? 'checked' : '') . " value=\"" . $recordOptions['record_select_vals'][$d] . "\" />\n" . "<label for=\"" . $elementNameId . $d . "\">" . $recordOptions['record_select_vals'][$d] . "</label>\n";
                 }
                 break;
             case "photo":
             case "multiphoto":
                 $formBody .= !empty($current[$records['db_name']]) ? "<div class=\"recordImg\">\n" . "<a title=\"Delete '" . $current[$records['db_name']] . "'\" data-id=\"" . $id . "\" data-recordname=\"" . $records['db_name'] . "\" data-filename=\"" . strtolower($current[$records['db_name']]) . "\"></a>\n" . "<img src=\"" . _SITEROOT_ . "uploads/" . $id . "/" . $records['db_name'] . "/300xauto_" . strtolower($current[$records['db_name']]) . "\" />\n" . "</div>\n" : '';
                 $formBody .= "<input type=\"file\" class=\"validate[" . ($recordOptions['record_required'] == 'true' && empty($current[$records['db_name']]) ? 'required' : 'optional') . ",checkFileType[jpg|jpeg|gif|JPG|png|PNG|ico|bmp]] fileInput\" name=\"" . $elementNameId . ($records['db_name'] == "multiphoto" ? "[]" : "") . "\" " . ($records['db_name'] == "multiphoto" ? " mulitple=\"multiple\" " : "") . " id=\"" . $elementNameId . "[]\" />\n";
                 break;
             case "file":
                 $ext = strtolower(pathinfo($current[$records['db_name']], PATHINFO_EXTENSION));
                 $formBody .= !empty($current[$records['db_name']]) ? "<div class=\"recordFile\">\n" . "<a class=\"deleteRecordFile\" title=\"Delete '" . $current[$records['db_name']] . "'\" data-id=\"" . $id . "\" data-recordname=\"" . $records['db_name'] . "\" data-filename=\"" . $current[$records['db_name']] . "\"></a>\n" . "<a href=\"" . _EQROOT_ . "resources/uploads/" . $id . "/" . $records['db_name'] . "/" . $current[$records['db_name']] . "\" target=\"_blank\" class=\"documentIcon " . $ext . "\"></a>\n" . "</div>\n" : '';
                 $formBody .= "<input value=\"" . $current[$records['db_name']] . "\" type=\"file\" class=\"validate[" . ($recordOptions['record_required'] == 'true' && empty($current[$records['db_name']]) ? 'required' : 'optional') . ",checkFileType[pdf|doc|docx|xls|csv|rar|txt|avi|mov|flv|mp3|zip|wav|php|html|css|js|jar|bak|tar|sys|exe|iso]] " . "fileInput\" name=\"" . $elementNameId . "\" id=\"" . $elementNameId . "\" />\n";
                 break;
             case "date":
                 $formBody .= "<input value=\"" . $current[$records['db_name']] . "\" type=\"text\" " . "class=\"datepicker validate[" . ($recordOptions['record_required'] == 'true' ? 'required' : 'optional') . "]\" name=\"" . $elementNameId . "\" id=\"" . $elementNameId . "\" />\n";
                 break;
             case "color":
                 $formBody .= "<input value=\"" . $current[$records['db_name']] . "\" type=\"text\" " . "class=\"colorpick validate[" . ($recordOptions['record_required'] == 'true' ? 'required' : 'optional') . "]\" id=\"" . $elementNameId . "\" name=\"" . $elementNameId . "\" id=\"" . $elementNameId . "\"/>\n\n                                 <label for=\"" . $elementNameId . "\" class=\"pick\"></label>\n";
                 break;
             case "time":
                 $formBody .= "<input value=\"" . $current[$records['db_name']] . "\" type=\"text\" class=\"timepicker validate[" . ($recordOptions['record_required'] == 'true' ? 'required' : 'optional') . "]\" name=\"" . $elementNameId . "\" id=\"" . $elementNameId . "\" size=\"10\">\n" . "<span class=\"ml10\">use your mousewheel and keyboard</span>\n";
                 break;
             case "foreignkey":
                 $fcomStruc_q = 'SELECT * FROM cms_plugin_structure 
                 				WHERE 
                 				id = "' . $records['fkey'] . '"';
                 $fcomStruc_r = mysql_query($fcomStruc_q);
                 $fcomStruc = mysql_fetch_array($fcomStruc_r);
                 $fFieldset_q = 'SELECT * FROM cms_fieldsets 
                                 WHERE
                                 com_struc_id = "' . $records['fkey'] . '"';
                 $fFieldset_r = mysql_query($fFieldset_q);
                 $fkeyFieldset = mysql_fetch_array($fFieldset_r);
                 $fetchKeys_q = 'SELECT * FROM cms_content 
                 				WHERE 
                 				pluginid = "' . $fcomStruc['pluginid'] . '"
                 				AND recordset = "' . $fcomStruc['db_name'] . '"';
                 $fetchKeys_r = mysql_query($fetchKeys_q);
                 $fkeyOptions = explode(',', $recordOptions['record_fkeyoptions']);
                 if (count($fkeyOptions)) {
                     $fkeyOptions = PluginListBuilder::validateRecordViaFieldset($fkeyOptions, $fkeyFieldset['id']);
                 } else {
                     $fkeyOptions = array('id');
                 }
                 $fkeyValues = explode(',', $recordOptions['record_fkeyvalue']);
                 if (count($fkeyOptions)) {
                     $fkeyValues = PluginListBuilder::validateRecordViaFieldset($fkeyValues, $fkeyFieldset['id']);
                 } else {
                     $fkeyValues = array('id');
                 }
                 $formBody .= "<select " . "class=\"validate[" . ($recordOptions['record_required'] == 'true' ? 'required' : 'optional') . "]\" " . "name=\"" . $elementNameId . ($recordOptions['record_fkeytype'] == 'multiselect' ? '[]' : '') . "\" " . "id=\"" . $elementNameId . ($recordOptions['record_fkeytype'] == 'multiselect' ? '[]' : '') . "\" " . ($recordOptions['record_fkeytype'] == 'multiselect' ? 'multiple="multiple"' : '') . "style=\"" . $recordOptions['record_styles'] . "\">\n";
                 while ($fetchKey = mysql_fetch_array($fetchKeys_r)) {
                     $fkeyValue = !empty($fkeyValues) ? $fetchKey[$fkeyValues[0]] : $fetchKey['id'];
                     $formBody .= "\n<option " . (preg_match('/\\b' . $fkeyValue . '\\b/', $current[$records['db_name']]) ? ' selected' : '') . ' value="' . $fkeyValue . '">';
                     foreach ($fkeyOptions as $option) {
                         $formBody .= $fetchKey[$option];
                     }
                     $formBody .= "</option>";
                 }
                 $formBody .= "\n</select>\n";
                 break;
             case "custom_url":
                 $formBody .= "<input type=\"text\" disabled=\"disabled\" value=\"" . $current[$records['db_name']] . "\"/>\n";
                 break;
         }
         $formBody .= "</div>\n";
         $formBody .= "<div class=\"fix\"></div>\n";
         $formBody .= "</div>\n";
     }
     return $formBody;
 }
Пример #22
0
                <a href="<?php 
            echo $appDelete . $ca->id;
            ?>
" onCLick="return confirm('Удалить приложение?');"><div class="setupBtn" style="margin-top:10px;">удалить</div></a>
				<?php 
        }
        ?>
			</div>
		</div>
		<a href="<?php 
        echo $appAction . $ca->id;
        ?>
"><?php 
        echo CHtml::encode($ca->caption);
        ?>
</a><br />
		<font class="usersCount">Пользователей: <?php 
        echo Apps::model()->explodeToTreads($ca->users);
        ?>
</font>
	</div>
	</td>
	<?php 
        $aid++;
    }
    ?>
</tr>
<?php 
}
?>
</table>