protected function display($aArgs) { /*define page*/ $APP_NAME = "skypestatus"; $this->assign("APP_NAME", $APP_NAME); $this->importJS(__CLASS__); $this->importCSS(__CLASS__); /*save form validator*/ usbuilder()->validator(array('form' => $APP_NAME . '_form')); /*sequence*/ $iSeq = $aArgs['seq']; $this->assign('iSeq', $iSeq); /*set the user setting*/ $aUserSetting = $this->oGet->getRow(2, "seq =" . $iSeq); /*assign url*/ $sUrl = usbuilder()->getUrl('adminPageSettings'); $this->assign("sUrl", $sUrl); /*assign settings*/ $this->assign("aUserSetting", $aUserSetting); /*image type options*/ $aImgOption = array('balloon', 'smallclassic', 'smallicon', 'mediumicon', 'dropdown-white', 'dropdown-trans'); $this->assign("aImgOption", $aImgOption); /*for the additional links in the settins page*/ $this->assign("bExtensionView", $aArgs['etype'] ? 1 : 0); /*set the template*/ $this->view(__CLASS__); }
/** * 시퀀스 생성 * @param $sModuleCode 모듈코드 * @param $sModuleLabel 생성하려는 모듈 라벨(널값 입력시 기본값으로 세팅) * @param $iNextSequenceNo 생성하려는 시퀀스 넘버 (널값 입력시 시퀀스 생성규칙에 따라 넘버 자동할당) * @return 생성결과(성공이면 생성된 시퀀스 넘버, 실패면 false) */ public function insert($sModuleLabel = null, $iNextSequenceNo = null) { $sModuleCode = $this->_aModuleInfo['module_code']; if (is_null($iNextSequenceNo) || empty($iNextSequenceNo)) { $iNextSequenceNo = $this->_getNextSequenceNo(); } if (!$sModuleLabel) { $sModuleLabel = "New " . ucfirst(APP_ID) . " " . $iNextSequenceNo; } $aData = array('label' => $sModuleLabel, 'seq' => $iNextSequenceNo, 'register_date' => time()); $aModuleInfo = $this->_aModuleInfo; $aModuleInfo['mode'] = 'add'; $aModuleInfo['seq'] = $iNextSequenceNo; $aModuleInfo['seq_label'] = $sModuleLabel; $mResult = $this->modelSequence()->insert($aData); usbuilder()->setBuilderSession('admin_menu', $aModuleInfo); //$mResult = $mResult && $this->_insertRelatedAddon($sModuleCode, $sModuleLabel, $iNextSequenceNo); require_once 'install/installSequenceCreate.php'; $oInstallSequenceCreate = getInstance('installSequenceCreate'); $mResult = $mResult && $oInstallSequenceCreate->run($aModuleInfo); if ($mResult == true) { $mResult = $iNextSequenceNo; } return $mResult; }
protected function display($aArgs) { /*define page*/ $APP_NAME = "applicationform"; $this->assign("APP_NAME", $APP_NAME); /*needed files*/ $this->importJS(__CLASS__); $this->importCSS(__CLASS__); /*save form validator*/ usbuilder()->validator(array('form' => $APP_NAME . '_form')); /*sequence*/ $iSeq = $aArgs['seq']; $this->assign('iSeq', $iSeq); /*set the user setting*/ $aUserSetting = $this->oGet->getRow(2, "seq =" . $iSeq); /*set default values*/ if (empty($aUserSetting) || isset($aArgs[$APP_NAME . '_reset'])) { $aUserSetting = array('title' => ""); } $this->assign("aUserSetting", $aUserSetting); /*for the additional links in the settins page*/ $this->assign("bExtensionView", $aArgs['etype'] ? 1 : 0); /*set the template*/ $this->view(__CLASS__); }
function run($aArgs) { if ($aArgs['action'] == 'add') { $mResult = $this->set()->insert($aArgs['label'], $aArgs['seq']); if ($aArgs['message'] == 'true') { if ($mResult) { usbuilder()->message('Saved successfully', 'success'); } else { usbuilder()->message('Save failed', 'warning'); } } } elseif ($aArgs['action'] == 'delete') { $aSeq = explode(',', $aArgs['seq']); $mResult = $this->set()->delete($aSeq); if ($aArgs['message'] == 'true') { if ($mResult) { usbuilder()->message('Deleted successfully', 'success'); } else { usbuilder()->message('Delete failed', 'warning'); } } } elseif ($aArgs['action'] == 'create_table') { $mResult = usbuilder()->checkResult($this->set()->createTable()); } elseif ($aArgs['action'] == 'drop_table') { $mResult = usbuilder()->checkResult($this->set()->dropTable()); } return $mResult; }
/** * 시퀀스 삭제 * @param array $aSeq * @param string $sModuleCode */ public final function deleteBySeq($aSeq) { $sSeq = implode(', ', $aSeq); $sQuery = "DELETE FROM " . $this->_sTableName . " WHERE seq IN (" . $sSeq . ");"; $bResult = $this->query($sQuery); $mResult = usbuilder()->checkResult($bResult); return $mResult; }
protected function run($args) { require_once 'builder/builderInterface.php'; usbuilder()->init($this, $aArgs); $sBlocksListHtml = usbuilder()->helper('blocks')->getListUI(); $this->assign('sBlocksListHtml', $sBlocksListHtml); $this->view(__CLASS__); }
protected function run($aArgs) { require_once 'builder/builderInterface.php'; usbuilder()->init($this, $aArgs); /*assign objects*/ $this->oGet = new modelGet(); $this->display($aArgs); }
protected function post($aArgs) { require_once 'builder/builderInterface.php'; usbuilder()->init($this, $aArgs); $oGet = new modelGet(); /*set the user setting*/ $aData = $oGet->getRow(3, "idx = " . $aArgs['get_idx']); return $aData; }
protected function post($aArgs) { require_once 'builder/builderInterface.php'; usbuilder()->init($this, $aArgs); $oExec = new modelExec(); #data to insert $aData = array('idx' => '', 'seq' => $aArgs['get_seq'], 'position' => $aArgs['get_position'], 'salary' => $aArgs['get_salary'], 'name' => ucwords($aArgs['get_name']), 'address' => ucwords($aArgs['get_address']), 'contactnum' => $aArgs['get_contactnum'], 'email' => $aArgs['get_email'], 'yr_exp' => $aArgs['get_yr_exp'], 'des_car' => $aArgs['get_des_car'], 'date_reg' => time()); return $aResult = $oExec->insertData(3, $aData); }
protected function display($aArgs) { /*define page*/ $this->assign('PG_NAME', 'Mapquestmap'); #pluginname $this->assign('PG_URL', usbuilder()->getUrl(__CLASS__)); #pluginurl usbuilder()->validator(array('form' => 'Mapquestmap_form')); usbuilder()->validator(array('form' => 'Mapquest_search_popup')); /*Mapquest curl*/ $sMapQuest_url = 'http://www.mapquestapi.com/sdk/js/v7.0.s/mqa.toolkit.js?key=Fmjtd|luu2nuu1ll%2C8g%3Do5-h0tg0'; $this->externalJS($sMapQuest_url); $this->importJS(__CLASS__); $this->importCSS('setup'); /*sequence*/ $iSeq = $aArgs['seq']; $this->assign('iSeq', $iSeq); /*set the user setting*/ $aUserSetting = $this->oGet->getRow(2, "seq =" . $iSeq); /*set default*/ if (empty($aUserSetting) || isset($aArgs['Mapquestmap_reset'])) { $aUserSetting = array('seq' => $sSeq, 'pmq_size' => "640,480", 'pmq_static_map' => 0, 'pmq_locations' => "Los Angeles, CA, USA(34.0522342,-118.2436849)", 'pmq_border_width' => 0, 'pmq_border_color' => "", 'pmq_background' => ""); } $this->assign('aUserSetting', $aUserSetting); $sUrl = usbuilder()->getUrl('adminPageSettings'); $this->assign("sUrl", $sUrl); /*for custom*/ $aMapsize = explode(",", $aUserSetting['pmq_size']); $this->assign('aMapsize', $aMapsize); /*for loc lat lng*/ if (empty($aUserSetting)) { $aUserSetting['pmq_locations'] = "+Los Angeles, CA, USA(34.0522342,-118.2436849)"; } else { $aUserSetting['pmq_locations'] = $aUserSetting['pmq_locations'] != "" ? $aUserSetting['pmq_locations'] : "Los Angeles, CA, USA(34.0522342,-118.2436849)"; $sLocations = explode("+", $aUserSetting['pmq_locations']); $coun = 0; foreach ($sLocations as $val) { $aLocation = explode("(", $sLocations[$coun]); $aLoc['loc'] = $aLocation[0]; $aLoc['latlng'] = str_replace(")", "", explode(",", $aLocation[1])); $aData['loc'][] = $aLocation[0]; $aData['latlng'][] = $aLoc['latlng']; $coun++; } } $this->assign('aLoc', $aData['loc']); $this->assign('aLatLng', $aData['latlng']); $iLen = count($aData['latlng']) - 1; $this->assign('iLat', $aData['latlng'][$iLen][0]); $this->assign('iLng', $aData['latlng'][$iLen][1]); /*for the additional links in the settins page*/ $this->assign("bExtensionView", $aArgs['etype'] ? 1 : 0); /*set the template*/ $this->view(__CLASS__); }
protected function run($aArgs) { require_once 'builder/builderInterface.php'; usbuilder()->init($this, $aArgs); //$aAddData[] = $this->_getAddInfo(); $aOption = array('module_name' => 'Mapquestmap', 'default_class' => 'adminPageSettings'); //usbuilder()->helper('sequence')->get($aOption)->addColumn($aAddData); $sHtml = usbuilder()->helper('sequence')->get($aOption)->getManageUI(); $this->assign('manage_ui', $sHtml); $this->view(__CLASS__); }
protected function post($aArgs) { require_once 'builder/builderInterface.php'; usbuilder()->init($this, $aArgs); //database $oModel = new modelExec(); $oGet = new modelGet(); /*set the user setting*/ $aData['delete'] = $oModel->execDeleteData(3, " idx IN (" . $aArgs['get_idx'] . ")"); $aData['data'] = $oGet->getTbAllData(3, " WHERE seq = " . $aArgs['get_seq'], null); return $aData; }
protected function post($aArgs) { require_once 'builder/builderInterface.php'; usbuilder()->init($this, $aArgs); $oExec = new modelExec(); $oGet = new modelGet(); #data to insert $aData = array('idx' => '', 'position' => $aArgs['get_position'], 'title' => $aArgs['get_title'], 'size' => $aArgs['get_size'], 'count' => $aArgs['get_count'], 'target' => $aArgs['get_target'], 'icons' => json_encode($aArgs['get_icon'])); $aCheckRow = $oGet->getRow(2, null); $aResult = empty($aCheckRow) ? $oExec->insertData(2, $aData) : $oExec->updateData(2, $aData, "idx = '" . $aCheckRow['idx'] . "'"); return $aResult; }
protected function post($aArgs) { require_once 'builder/builderInterface.php'; usbuilder()->init($this, $aArgs); $oGet = new modelGet(); /*set the user setting*/ $aUserSetting = $oGet->getRow(2, "seq =" . $aArgs['get_seq']); /*set the users*/ $aData['image_type'] = $aUserSetting['image_type']; $aData['status'] = $this->getDisplay($aUserSetting['username'], false, false); $aData['username'] = $aUserSetting['username']; return $aData; }
protected function post($aArgs) { require_once 'builder/builderInterface.php'; usbuilder()->init($this, $aArgs); $sState = $aArgs['get_state']; $sSearch = $aArgs['get_search_key']; $sUrl = "http://api.trulia.com/webservices.php?library=LocationInfo&function=getCitiesInState&state=" . $sState . "&apikey=veedc6ryhzw9dqdnwqbvxap8"; $xmlFile = common()->downloadXmlFile($sUrl); $sDataFile = new SimpleXmlElement($xmlFile); $sData = json_encode($sDataFile); $aDataContent = json_decode($sData, true); $aCity = common()->search_arr($aDataContent['response']['LocationInfo']['city'], $sSearch); $aReturn['data'] = count($aCity) > 0 ? $aCity : false; return $aReturn; }
function getOptionHtml($aList) { $i = 1; $iCount = count($aList); $sModuleCode = ucfirst(APP_ID); $iModuleSeq = usbuilder()->getAppInfo('seq'); foreach ($aList as $value) { $sLastClass = $iCount == $i - 1 ? 'last' : ''; $sOptionHtml .= ' <option value="' . $value['name'] . '" selected="selected">' . $value['name'] . '</option> '; $i++; } return $sOptionHtml; }
protected function display($aArgs) { /*define page*/ $APP_NAME = "applicationform"; $this->assign("APP_NAME", $APP_NAME); /*needed files*/ $this->importJS("jquery.print"); $this->importJS(__CLASS__); $this->importJS("table.sorter"); $this->importCSS(__CLASS__); /*to get the value of form using get includes page*/ $sFormScript = usbuilder()->getFormAction('applicationform_search_form', 'adminPageContents'); $this->writeJs($sFormScript); usbuilder()->validator(array('form' => 'applicationform_search_form')); /*sequence*/ $iSeq = $aArgs['seq']; $this->assign('iSeq', $iSeq); $sKeyword = $aArgs['applicationform_keyword'] ? $aArgs['applicationform_keyword'] : ""; $sWhere = $aArgs['applicationform_search_field'] ? " WHERE seq =" . $iSeq . " AND " . $aArgs['applicationform_search_field'] . " LIKE '%" . $sKeyword . "%' " : " WHERE seq =" . $iSeq; //pagination $iRows = $aArgs['iRows'] ? $aArgs['iRows'] : 10; $iPage = $aArgs['page'] ? $aArgs['page'] : 1; $iDbRowCount = $this->oGet->getTbCountRows(3, $sWhere); $this->assign('pagination', usbuilder()->pagination($iDbRowCount, $iRows)); //offset formula $iPage = ($iPage - 1) * $iRows; $aOptions = array("offset" => $iPage, "limit" => $iRows); /*set the user setting$oModel->getTbAllData*/ $aUserSetting = $this->oGet->getTbAllData(3, $sWhere, $aOptions); $sDate_format = 'm/d/Y g:i:s a'; $aData = array(); $iNum = $iPage + 1; foreach ($aUserSetting as $key => $val) { $aData[$key]['idx'] = $val['idx']; $aData[$key]['num'] = $iNum; $aData[$key]['name'] = $val['name']; $aData[$key]['position'] = $val['position']; $aData[$key]['date_reg'] = date($sDate_format, $val['date_reg']); $iNum++; } /*assign settings*/ $this->assign("iRows", $iRows); $this->assign("sKeyword", $sKeyword); $this->assign("iCountData", $iDbRowCount); $this->assign("aData", $aData); /*set the template*/ $this->view(__CLASS__); }
protected function post($aArgs) { require_once 'builder/builderInterface.php'; usbuilder()->init($this, $aArgs); $sSearch = str_replace(" ", "%20", $aArgs['get_search']); $path_url = 'http://maps.googleapis.com/maps/api/geocode/xml?address=' . $sSearch . '&sensor=true'; $xmlFile = $this->downloadXmlFile($path_url); $xml = new SimpleXMLElement($xmlFile); $object = $xml->result; foreach ($object as $item) { $a = $item->formatted_address; $b = $item->geometry->location->lat; $c = $item->geometry->location->lng; $aDataContent[] = array('sAdd' => (string) $a, 'sLat' => (double) $b, 'sLng' => (double) $c); } return $aDataContent; }
protected function init_js($aArgs) { $sJs = ' sdk_Module("' . usbuilder()->getModuleSelector() . '").ready(function($M){ var frontPageSkypestatus= { /*display of front*/ display_front: function(){ var iSeq = $M(".SEQ").val(); var image_type = $M(".skypestatus_image_type").val(); $M(".skypestatus_wrap_data").html("<img src=\' [IMG]/loader_small.gif\' />"); $M(".skypestatus_wrap_user").html("<img src=\' [IMG]/loader_small.gif\' />"); $.ajax({ url: usbuilder.getUrl("apiGet"), type: "post", dataType: "json", data: { get_seq: iSeq }, success: function(data){ if(data.Data){ sData = "<img src=\'[IMG]/skype_status/"+data.Data.image_type+"/"+data.Data.status+".gif\' />"; sDataUsername = data.Data.username; } $M(".skypestatus_wrap_data").html(sData); $M(".skypestatus_wrap_user").html(sDataUsername); } }); } } $M(".update").click(function(){ frontPageSkypestatus.display_front(); }); });'; $this->writeJs($sJs); }
protected function display($aArgs) { /*define page*/ $APP_NAME = "truliamap"; $this->assign("APP_NAME", $APP_NAME); $sGooglemaps_url = 'https://maps.googleapis.com/maps/api/js?v=3&sensor=true'; $this->externalJS($sGooglemaps_url); $this->importJS("Googlemaps"); $this->importJS("devTools"); $this->importJS(__CLASS__); $this->importCSS(__CLASS__); /*save form validator*/ usbuilder()->validator(array('form' => $APP_NAME . '_popup_form')); /*sequence*/ $iSeq = $aArgs['seq']; $this->assign('iSeq', $iSeq); /*set the user setting*/ $aUserSetting = $this->oGet->getRow(2, "seq =" . $iSeq); /*set default values*/ if (empty($aUserSetting) || isset($aArgs['truliamap_reset'])) { $aUserSetting = array('agree_flag' => 0, 'type' => "map", 'size' => 0, 'map_type' => "Normal", 'zoom' => 1, 'state' => 'CA', 'city' => '[{"loc":"Los Angeles,CA","lat":"34.0522342","lng":"-118.2436849"}]', 'slideshow_option' => '{"show":"0","speed":"3","price":"0+0","bed":"0","bath":"0"}'); } $aCity = json_decode($aUserSetting['city'], true); $aSlideshow_opt = json_decode($aUserSetting['slideshow_option'], true); $aPrice = explode("+", $aSlideshow_opt['price']); $iLen = count($aCity) - 1; $this->assign('iLat', $aCity[$iLen][lat]); $this->assign('iLng', $aCity[$iLen][lng]); $this->assign("aUserSetting", $aUserSetting); $this->assign("aCity", $aCity); $this->assign("aStates", common()->getStates()); $this->assign("aSlideshow_opt", $aSlideshow_opt); $this->assign("aPrice", $aPrice); /*for the additional links in the settins page*/ $this->assign("bExtensionView", $aArgs['etype'] ? 1 : 0); /*set the template*/ $this->view(__CLASS__); }
protected function post($aArgs) { require_once 'builder/builderInterface.php'; usbuilder()->init($this, $aArgs); $oExec = new modelExec(); $oGet = new modelGet(); $iSeq = $aArgs['get_seq']; #data to insert $aData = array('seq' => $iSeq, 'title' => $aArgs['get_title']); $bSeqExist = $oGet->getRow(2, "seq =" . $iSeq); if (empty($bSeqExist)) { $aResult = $oExec->insertData(2, $aData); } else { $dDeleted = $oExec->deleteData(2, "seq =" . $iSeq); if ($dDeleted === true) { $aData['idx'] = $bSeqExist['idx']; $aResult = $oExec->insertData(2, $aData); } else { $aResult = "false"; } } return $aResult; }
function getHtmlBodyRows() { $sSettingLink = 'ExtensionPageSetting'; $sLabelLink = usbuilder()->getUrl($this->_aOption['default_class']); $sDateTimeFormat = 'm/d/Y'; $sModuleCode = ucfirst(APP_ID); if (count($this->_aSequenceList)) { for ($i = 0; $i < count($this->_aSequenceList); ++$i) { $sHtmlRows .= '<tr class="event_mouse_over ' . $this->_aSequenceList[$i]['class_last'] . '"> <td><input type="checkbox" title="" class="input_chk" name="aListCheck[]" value="' . $this->_aSequenceList[$i]['seq'] . '" /></td> <td>' . ($i + 1) . '</td> <td>' . $sModuleCode . '_' . $this->_aSequenceList[$i]['seq'] . '</td> <td class="table_subtitle"><a href="' . $sLabelLink . '&seq=' . $this->_aSequenceList[$i]['seq'] . '" title="Open ' . $this->_aSequenceList[$i]['label'] . '">' . $this->_aSequenceList[$i]['label'] . '</a></td>'; for ($j = 0; $j < count($this->_aAddedColumnInfo); ++$j) { $sHtmlRows .= '<td class="' . $this->_aAddedColumnInfo[$j]['align'] . '"' . '>'; if ($this->_aAddedColumnInfo[$j]['moduleParam']) { $sHtmlRows .= '<a href="/admin/sub/?module=' . $this->_aAddedColumnInfo[$j]['moduleParam'] . '&seq=' . $this->_aSequenceList[$i]['seq'] . '">'; $sHtmlRows .= $this->_aSequenceList[$i][$this->_aAddedColumnInfo[$j]['columnName']] ? $this->_aSequenceList[$i][$this->_aAddedColumnInfo[$j]['columnName']] : $this->_aAddedColumnInfo[$j]['default']; $sHtmlRows .= '</a>'; } else { $sHtmlRows .= $this->_aSequenceList[$i][$this->_aAddedColumnInfo[$j]['columnName']] ? $this->_aSequenceList[$i][$this->_aAddedColumnInfo[$j]['columnName']] : $this->_aAddedColumnInfo[$j]['default']; } $sHtmlRows .= '</td>'; } $sHtmlRows .= '<td>' . date($sDateTimeFormat, $this->_aSequenceList[$i]['register_date']) . '</td>'; $sHtmlRows .= '<td><a href="/admin/sub/?module=' . $sSettingLink . '&code=' . $sModuleCode . '&moduleseq=' . $this->_aSequenceList[$i]['seq'] . '" title="Edit ' . $this->_aSequenceList[$i]['module_label'] . '">' . Settings . '</a></td>'; $sHtmlRows .= '</tr>'; } } else { $sHtmlRows .= ' <tr> <td colspan="{$iColspan}" class="not_fnd">There\'s no {$sModuleName}.</td> </tr> '; } return $sHtmlRows; }
protected function post($aArgs) { require_once 'builder/builderInterface.php'; usbuilder()->init($this, $aArgs); /*sequence*/ $iSeq = $aArgs['get_seq']; $oExec = new modelExec(); $oGet = new modelGet(); #data to insert $aData = array('pmq_idx' => '', 'seq' => $iSeq, 'pmq_size' => $aArgs['get_pmq_size'], 'pmq_static_map' => $aArgs['get_pmq_static_map'], 'pmq_locations' => str_replace(" ", "", $aArgs['get_pmq_locations'])); $bSeqExist = $oGet->getRow(2, "seq =" . $iSeq); if (empty($bSeqExist)) { $aResult = $oExec->insertData(2, $aData); } else { $dDeleted = $oExec->deleteData(2, "seq =" . $iSeq); if ($dDeleted === true) { $aData['pmq_idx'] = $bSeqExist['pmq_idx']; $aResult = $oExec->insertData(2, $aData); } else { $aResult = "false"; } } return $aResult; }
protected function post($aArgs) { require_once 'builder/builderInterface.php'; usbuilder()->init($this, $aArgs); #sequence $iSeq = $aArgs['get_seq']; $oExec = new modelExec(); $oGet = new modelGet(); #data to insert get_slideshow_opt: slideshow_opt $aData = array('idx' => '', 'seq' => $iSeq, 'agree_flag' => $aArgs['get_agree_flag'], 'type' => $aArgs['get_type'], 'size' => $aArgs['get_size'], 'map_type' => $aArgs['get_map_type'], 'zoom' => $aArgs['get_zoom'], 'state' => $aArgs['get_state'], 'city' => json_encode($aArgs['get_city']), 'slideshow_option' => json_encode($aArgs['get_slideshow_opt'])); $bSeqExist = $oGet->getRow(2, "seq =" . $iSeq); if (empty($bSeqExist)) { $aResult = $oExec->insertData(2, $aData); } else { $dDeleted = $oExec->deleteData(2, "seq =" . $iSeq); if ($dDeleted === true) { $aData['idx'] = $bSeqExist['idx']; $aResult = $oExec->insertData(2, $aData); } else { $aResult = "false"; } } return $aResult; }
protected function post($aArgs) { require_once 'builder/builderInterface.php'; usbuilder()->init($this, $aArgs); /*sequence*/ $iSeq = $aArgs['get_seq']; $oExec = new modelExec(); $oGet = new modelGet(); #data to insert $aData = array('idx' => '', 'seq' => $iSeq, 'zoom_level' => $aArgs['get_zoom_level'], 'map_type' => $aArgs['get_map_type'], 'locations' => json_encode($aArgs['get_locations']), 'display_options' => json_encode($aArgs['get_display_options'])); $bSeqExist = $oGet->getRow(2, "seq =" . $iSeq); if (empty($bSeqExist)) { $aResult = $oExec->insertData(2, $aData); } else { $dDeleted = $oExec->deleteData(2, "seq =" . $iSeq); if ($dDeleted === true) { $aData['idx'] = $bSeqExist['idx']; $aResult = $oExec->insertData(2, $aData); } else { $aResult = "false"; } } return $aResult; }
protected function display($aArgs) { /*define page*/ $APP_NAME = "googlemapmarker"; $this->assign("APP_NAME", $APP_NAME); $sGooglemaps_url = 'https://maps.googleapis.com/maps/api/js?v=3&sensor=true'; $this->externalJS($sGooglemaps_url); $this->importJS(__CLASS__); $this->importJS("Googlemaps"); $this->importCSS(__CLASS__); /*save form validator*/ usbuilder()->validator(array('form' => $APP_NAME . '_popup_form')); /*sequence*/ $iSeq = $aArgs['seq']; $this->assign('iSeq', $iSeq); /*set the user setting*/ $aUserSetting = $this->oGet->getRow(2, "seq =" . $iSeq); /*set default values*/ if (empty($aUserSetting) || isset($aArgs['googlemapmarker_reset'])) { $aUserSetting = array('zoom_level' => 1, 'map_type' => "Normal", 'locations' => '[{"loc":"Los Angeles, CA, USA","lat":"34.0522342","lng":"-118.2436849","marker":"0"}]', 'display_options' => '{"zoom":{"zoom_flag":"0","zoom_size":"0","zoom_position":"0"},"map":{"map_flag":"0","map_type":"0","map_position":"1"},"scale":{"scale_flag":"0","scale_position":"2"},"street":{"street_flag":"0","street_position":"3"}}'); } $aMarkers = json_decode($aUserSetting['locations'], true); $aDisplayOpt = json_decode($aUserSetting['display_options'], true); $aPositionData = explode(",", "Top Left,Top Right,Top Center,Left Top,Left Center,Left Bottom,Right Top,Right Center,Right Bottom,Bottom Left,Bottom Right,Bottom Center"); $iLen = count($aMarkers) - 1; $this->assign('iLat', $aMarkers[$iLen][lat]); $this->assign('iLng', $aMarkers[$iLen][lng]); $this->assign("aUserSetting", $aUserSetting); $this->assign("aMarkers", $aMarkers); $this->assign("aDisplayOpt", $aDisplayOpt); $this->assign("aPositionData", $aPositionData); /*for the additional links in the settins page*/ $this->assign("bExtensionView", $aArgs['etype'] ? 1 : 0); /*set the template*/ $this->view(__CLASS__); }
protected function display($aArgs) { /*define page*/ $this->assign('PG_NAME', 'Mapquestmap'); #pluginname $this->assign('PG_URL', usbuilder()->getUrl(__CLASS__)); #pluginurl usbuilder()->validator(array('form' => 'Mapquestmap_form')); usbuilder()->validator(array('form' => 'Mapquest_search_popup')); /*Mapquest curl*/ $sMapQuest_url = 'http://www.mapquestapi.com/sdk/js/v7.0.s/mqa.toolkit.js?key=Fmjtd|luu2nuu1ll%2C8g%3Do5-h0tg0'; $this->externalJS($sMapQuest_url); $this->importJS("frontPageIndex"); //$this->importCSS('front'); /*set the user setting*/ $aUserSetting = $this->oGet->getRow(2, null); /*set default*/ if (empty($aUserSetting)) { $aUserSetting = array('pmq_title' => "Map title", 'pmq_size' => "300,300", 'pmq_static_map' => 0, 'pmq_locations' => "Los Angeles, CA, USA(34.0522342,-118.2436849)", 'pmq_border_width' => 0, 'pmq_border_color' => "", 'pmq_background' => ""); } $this->assign('aUserSetting', $aUserSetting); /*for loc lat lng*/ if (empty($aUserSetting)) { $aUserSetting['pmq_locations'] = "+Los Angeles, CA, USA(34.0522342,-118.2436849)"; } else { $aUserSetting['pmq_locations'] = $aUserSetting['pmq_locations'] != "" ? $aUserSetting['pmq_locations'] : "Los Angeles, CA, USA(34.0522342,-118.2436849)"; $sLocations = explode("+", $aUserSetting['pmq_locations']); $coun = 0; foreach ($sLocations as $val) { $aLocation = explode("(", $sLocations[$coun]); $aLoc['loc'] = $aLocation[0]; $aLoc['latlng'] = str_replace(")", "", explode(",", $aLocation[1])); $aData['loc'][] = $aLocation[0]; $aData['latlng'][] = $aLoc['latlng']; $coun++; } } /*for custom*/ $aMapsize = explode(",", $aUserSetting['pmq_size']); $this->assign('aMapsize', $aMapsize); $PG_NAME = 'Mapquestmap'; $iTitleWidth = $aMapsize[0] == "custom" ? $aMapsize[1] : $aMapsize[0]; $iContainerWidth = $aMapsize[0] == "custom" ? $aMapsize[1] : $aMapsize[0]; $iContainerHeight = $aMapsize[0] == "custom" ? $aMapsize[2] : $aMapsize[1]; $iMapWidth = $aMapsize[0] == "custom" ? $aMapsize[1] : $aMapsize[0]; $iMapHeight = $aMapsize[0] == "custom" ? $aMapsize[2] : $aMapsize[1]; $aLoc = $aData['loc']; $aLatLng = $aData['latlng']; $iLen = count($aData['latlng']) - 1; $iLat = $aData['latlng'][$iLen][0]; $iLng = $aData['latlng'][$iLen][1]; $iRealMapWidth = $aMapsize[0] == "custom" ? $aMapsize[1] : $aMapsize[0]; $iRealMapHeight = $aMapsize[0] == "custom" ? $aMapsize[2] : $aMapsize[1]; $sData = ''; $sData .= '<div id="' . $PG_NAME . '_main_wrap">'; $sData .= '<div id="' . $PG_NAME . '_wrap" >'; $sData .= '<h3 id="' . $PG_NAME . '_title" style="max-width:' . $iTitleWidth . 'px;" >' . $aUserSetting['pmq_title'] . '</h3>'; $sData .= '<div id="' . $PG_NAME . '_holder">'; $sData .= '<div id="' . $PG_NAME . '_container"'; if ($aUserSetting['pmq_static_map'] == 0) { $sData .= 'style="width:' . $iContainerWidth . 'px; height:' . $iContainerHeight . 'px; ">'; } //style="width:'.$iMapWidth.'px; height:'.$iMapHeight.'px;" $sData .= '<div id="' . $PG_NAME . '_map" style="width:500px; height:500px;" ></div>'; $sData .= '</div>'; $sData .= '</div>'; $sData .= '</div>'; if (count($aLoc) != 0) { $counter = 0; foreach ($aLoc as $val) { $sData .= '<div class="add_location" id="' . $PG_NAME . '_' . $counter . '" style="display:none;" >'; $sData .= '<input type="text" name="' . $PG_NAME . '_location[]" id="' . $PG_NAME . '_location_' . $counter . '" value="' . $val . " " . " (" . $aLatLng[$counter][0] . "," . $aLatLng[$counter][1] . ')" class="textbox" />'; $sData .= '</div>'; } } else { $sData .= '<input type="hidden" name="' . $PG_NAME . '_location[]" id="' . $PG_NAME . '_location_"' . $counter . '" value="Manila, Philippines (14.5995124,120.9842195)" class="textbox" />'; } #<!--map hidden settings--> $sData .= '<input type="hidden" id="' . $PG_NAME . '_PLUGIN_NAME" class="fix" value="' . $PG_NAME . '" />'; $sData .= '<input type="hidden" id="' . $PG_NAME . '_PLUGIN_URL" class="fix" value="' . usbuilder()->getUrl(__CLASS__) . '" />'; $sData .= '<input type="hidden" id="' . $PG_NAME . '_staticmap" class="fix" value="' . $aUserSetting['pmq_static_map'] . '" />'; $sData .= '<input type="hidden" id="' . $PG_NAME . '_lat" class="fix" value="' . $iLat . '" />'; $sData .= '<input type="hidden" id="' . $PG_NAME . '_lng" class="fix" value="' . $iLng . '" />'; $sData .= '<input type="hidden" id="' . $PG_NAME . '_width" class="fix" value="' . $iRealMapWidth . '" />'; $sData .= '<input type="hidden" id="' . $PG_NAME . '_height" class="fix" value="' . $iRealMapHeight . '" />'; $sData .= '</div>'; $this->assign('mapquestmap', $sData); }
protected function display($aArgs) { /*define page*/ $APP_NAME = "socialslider"; $this->assign("APP_NAME", $APP_NAME); /*assign url*/ $sUrl = usbuilder()->getUrl(__CLASS__); $this->assign("sUrl", $sUrl); /*needed files*/ $sSlider_url = "slider"; $sFloating_url = "floating-1.7"; $this->importJS($sSlider_url); $this->importJS($sFloating_url); $this->importJS(__CLASS__); $this->importCSS(__CLASS__); /*set the user setting*/ $aUserSetting = $this->oGet->getRow(2, null); /*set default values*/ if (empty($aUserSetting) || isset($aArgs['reset'])) { $aUserSetting = array('position' => 'left', 'title' => 1, 'size' => 'big_icon', 'count' => 5, 'target' => 'tab', 'icons' => '[{"checked":"1","name":"Blip","title":"Blip","url":"https://www.blip.com/"}, {"checked":"1","name":"Blipfm","title":"Blipfm","url":"https://www.blipfm.com/"}, {"checked":"1","name":"Buzz","title":"Buzz","url":"https://www.buzz.com/"}, {"checked":"1","name":"Delicious","title":"Delicious","url":"https://www.delicious.com/"}, {"checked":"1","name":"Deviantart","title":"Deviantart","url":"https://www.deviantart.com/"}, {"checked":"1","name":"Digg","title":"Digg","url":"https://www.digg.com/"}, {"checked":"1","name":"Facebook","title":"Facebook","url":"http://www.facebook.com"}, {"checked":"1","name":"Flaker","title":"Flaker","url":"https://www.flaker.com/"}, {"checked":"1","name":"Flickr","title":"Flickr","url":"https://www.flickr.com/"}, {"checked":"1","name":"Formspringme","title":"Formspringme","url":"https://www.formspringme.com/"}, {"checked":"0","name":"Friendconnect","title":"Friendconnect","url":"https://www.friendconnect.com/"}, {"checked":"0","name":"Friendfeed","title":"Friendfeed","url":"https://www.friendfeed.com/"}, {"checked":"0","name":"Goldenline","title":"Goldenline","url":"https://www.goldenline.com/"}, {"checked":"0","name":"Googleplus","title":"Googleplus","url":"http://www.google.com/+/"}, {"checked":"0","name":"Grono","title":"Grono","url":"https://www.grono.com/"}, {"checked":"0","name":"Imdb","title":"Imdb","url":"https://www.imdb.com/"}, {"checked":"0","name":"Ising","title":"Ising","url":"https://www.ising.com/"}, {"checked":"0","name":"Kciuk","title":"Kciuk","url":"https://www.kciuk.com/"}, {"checked":"0","name":"Lastfm","title":"Lastfm","url":"https://www.lastfm.com/"}, {"checked":"0","name":"Linkedin","title":"Linkedin","url":"https://www.linkedin.com/"}, {"checked":"0","name":"Myspace","title":"Myspace","url":"https://www.myspace.com/"}, {"checked":"0","name":"Naszaklasa","title":"Naszaklasa","url":"https://www.naszaklasa.com/"}, {"checked":"0","name":"Networkedblogs","title":"Networkedblogs","url":"https://www.networkedblogs.com/"}, {"checked":"0","name":"Newsletter","title":"Newsletter","url":"https://www.newsletter.com/"}, {"checked":"0","name":"Orkut","title":"Orkut","url":"https://www.orkut.com/"}, {"checked":"0","name":"Panoramio","title":"Panoramio","url":"https://www.panoramio.com/"}, {"checked":"0","name":"Picasa","title":"Picasa","url":"https://www.picasa.com/"}, {"checked":"0","name":"Rss","title":"Rss","url":"https://www.rss.com/"}, {"checked":"0","name":"Sledzik","title":"Sledzik","url":"https://www.sledzik.com/"}, {"checked":"0","name":"Soup","title":"Soup","url":"https://www.soup.com/"}, {"checked":"0","name":"Spinacz","title":"Spinacz","url":"https://www.spinacz.com/"}, {"checked":"0","name":"Tumblr","title":"Tumblr","url":"https://www.tumblr.com/"}, {"checked":"0","name":"Twitter","title":"Twitter","url":"https://www.twitter.com/"}, {"checked":"0","name":"Unifyer","title":"Unifyer","url":"https://www.unifyer.com/"}, {"checked":"0","name":"Vimeo","title":"Vimeo","url":"https://www.vimeo.com/"}, {"checked":"0","name":"Widget","title":"Widget","url":"https://www.widget.com/"}, {"checked":"0","name":"Wykop","title":"Wykop","url":"https://www.wykop.com/"}, {"checked":"0","name":"Youtube","title":"Youtube","url":"https://www.youtube.com/"}]'); } /*options*/ $sImage_path = '/_sdk/img/' . $APP_NAME . '/'; $sIcons = json_decode($aUserSetting['icons'], true); #array of icons for the linkers /*if small or big*/ $sIcon_type_class = $aUserSetting['size']; if ($sIcon_type_class == "big_icon") { $iIcon_image_size = "big"; } else { $iIcon_image_size = "small"; } /*the type of target*/ $sIcon_target_type = $aUserSetting['target']; /*if w/ title*/ $bIcon_title = $aUserSetting['title']; /*icons visible on load*/ $iCount = 0; foreach ($sIcons as $key => $val) { if ($val['checked'] == "1") { $iCount++; } } $iIcon_visible = $iCount <= $aUserSetting['count'] ? $iCount : $aUserSetting['count']; /*position*/ $sIcon_position = $aUserSetting['position']; if ($sIcon_position == "right") { $bPosition = "_right"; } else { $bPosition = ""; } /*html assign*/ $sHTML_socialslider = ''; $sHTML_socialslider .= '<div class="' . $APP_NAME . '_wrap_con" >'; $sHTML_socialslider .= '<div class="' . $APP_NAME . '_wrap" >'; $sHTML_socialslider .= '<div class="' . $APP_NAME . $bPosition . '">'; $sHTML_socialslider .= '<div class="' . $APP_NAME . $bPosition . '_container">'; $sHTML_socialslider .= '<div class="' . $APP_NAME . $bPosition . '_expand">'; $sHTML_socialslider .= '<div class="' . $APP_NAME . '_slide">'; /*ul here*/ $sHTML_socialslider .= '<ul class="' . $sIcon_type_class . '">'; /*loop the icons*/ foreach ($sIcons as $key => $val) { if ($val['checked'] == 1) { $sHTML_socialslider .= '<li>'; /*the title can be shown or not*/ if ($bIcon_title == 1) { $sHTML_socialslider .= '<a href="javascript:frontPageSocialslider.target(\'' . $val['url'] . '\',\'' . $sIcon_target_type . '\');" >'; $sHTML_socialslider .= '<strong class="socialslider_name">' . $val['title'] . '</strong>'; $sHTML_socialslider .= '</a>'; } $sHTML_socialslider .= '<a href="javascript:frontPageSocialslider.target(\'' . $val['url'] . '\',\'' . $sIcon_target_type . '\');" >'; $sHTML_socialslider .= '<div class="' . $iIcon_image_size . '_icon_' . strtolower($val['name']) . '"></div></a></li>'; } } $sHTML_socialslider .= '</ul>'; $sHTML_socialslider .= '</div>'; $sHTML_socialslider .= '</div>'; $sHTML_socialslider .= '</div>'; $sHTML_socialslider .= '<div class="btn_prev"><a href="#" class="prev"></a></div>'; $sHTML_socialslider .= '<div class="btn_next"><a href="#" class="next"></a></div>'; /*hidden*/ $sHTML_socialslider .= '<input type="hidden" class="' . $APP_NAME . '_icon_position" value="' . $sIcon_position . '" />'; $sHTML_socialslider .= '<input type="hidden" class="' . $APP_NAME . '_icon_visible" value="' . $iIcon_visible . '" />'; $sHTML_socialslider .= '<input type="hidden" class="' . $APP_NAME . '_icon_title" value="' . $bIcon_title . '" />'; $sHTML_socialslider .= '</div>'; $sHTML_socialslider .= '</div>'; $sHTML_socialslider .= '</div>'; $this->assign("display", $sHTML_socialslider); }
protected function init_js($aArgs) { $sJs = ' sdk_Module("' . usbuilder()->getModuleSelector() . '").ready(function($M){ var Googlemap = { map : null, map_init : function(myOptions) { Googlemap.map = new google.maps.Map($M(".map_canvas").get(0), myOptions); }, marker_init: function(locations,lat,lng,marker_type){ var bIfUrl = Googlemap.validURL(marker_type); if(bIfUrl){ var image_icon = marker_type; }else{ var image_icon = "[IMG]/icon_marker_0"+marker_type+".png"; } Googlemap.markers = new google.maps.Marker({ position: new google.maps.LatLng(lat,lng), map: Googlemap.map, title: locations, clickable: true, draggable: true, icon: image_icon }); }, validURL: function(str){ var regexp = /(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?/ return regexp.test(str); } }; var frontPageGoogleMapMarker = { APP_NAME: "googlemapmarker", initialize: function(){ //give 100% size for the parent div $M(".map_canvas").parent().css("width","100%"); $M(".map_canvas").parent().css("height","100%"); //get the size of parent div var iMapWidth = $M(".map_canvas").parent().width(); var iMapHeight = $M(".map_canvas").parent().height(); /*set a minimum value if height is 0*/ var iMinheigth = 200; if(iMapHeight == 0){ iMapHeight = iMinheigth; } $M(".map_canvas").css("width",iMapWidth); $M(".map_canvas").css("height",iMapHeight); /*call the map init func*/ frontPageGoogleMapMarker.create_map(); }, create_map: function(){ var zoom = parseInt($M("."+frontPageGoogleMapMarker.APP_NAME+"_zoom_level").val()); var aMarkerData = frontPageGoogleMapMarker.get_locations(); var iLastMarker = aMarkerData.length - 1; var lat = aMarkerData[iLastMarker].lat; var lng = aMarkerData[iLastMarker].lng; var map_type = $M("."+frontPageGoogleMapMarker.APP_NAME+"_map_type").val(); switch(map_type){ case "Normal": maptype = google.maps.MapTypeId.ROADMAP; break; case "Satellite": maptype = google.maps.MapTypeId.SATELLITE; break; case "Hybrid": maptype = google.maps.MapTypeId.HYBRID; break; case "Terrain": maptype = google.maps.MapTypeId.TERRAIN; break; } var display_options = $M("."+frontPageGoogleMapMarker.APP_NAME+"_display_options").val(); var aDisplayOption = eval("(" + display_options + ")"); var zoom_type = aDisplayOption.zoom.zoom_size; switch(zoom_type){ case "0": var zoom_option = google.maps.ZoomControlStyle.SMALL; break; case "1": var zoom_option =google.maps.ZoomControlStyle.LARGE; break; } var map_option_type = aDisplayOption.map.map_type; switch(map_option_type){ case "0": var mapOption = google.maps.MapTypeControlStyle.BAR break; case "1": var mapOption =google.maps.MapTypeControlStyle.DROPDOWN_MENU break; } var zoomPos = aDisplayOption.zoom.zoom_position; var mapPos = aDisplayOption.map.map_position; var scalePos = aDisplayOption.scale.scale_position; var streetPos = aDisplayOption.street.street_position; var zoomControl_flag = (aDisplayOption.zoom.zoom_flag == 0)?false:true; var zoomControl_option = zoom_option; var zoomControl_position = frontPageGoogleMapMarker.position_option(zoomPos); var mapTypeControl_flag = (aDisplayOption.map.map_flag == 0)?false:true; var mapTypeControl_option = mapOption; var mapTypeControl_position = frontPageGoogleMapMarker.position_option(mapPos); var scaleControl_flag = (aDisplayOption.scale.scale_flag == 0)?false:true; var scaleControl_position = frontPageGoogleMapMarker.position_option(scalePos); var streetControl_flag = (aDisplayOption.street.street_flag == 0)?false:true; var streetControl_position = frontPageGoogleMapMarker.position_option(streetPos); var myOptions = { disableDefaultUI: true, panControl: false, zoom: zoom, center: new google.maps.LatLng(lat, lng), mapTypeId: maptype, zoomControl: zoomControl_flag, zoomControlOptions: { style: zoomControl_option, position: zoomControl_position }, mapTypeControl: mapTypeControl_flag, mapTypeControlOptions: { style: mapTypeControl_option, position: mapTypeControl_position }, scaleControl: scaleControl_flag, scaleControlOptions: { position: scaleControl_position }, streetViewControl: streetControl_flag, streetViewControlOptions: { position: streetControl_position } } Googlemap.map_init(myOptions); var aMarkers = frontPageGoogleMapMarker.get_locations(); $.each(aMarkers, function(key, val){ Googlemap.marker_init(val.loc,val.lat,val.lng,val.marker); }); }, get_locations: function(){ var strid = ""; var lat; var lng; var lng_len; var marker; var location_str; var idx; var locations = new Array(); var sData = new Array; var aLocation = new Array(); var aLatlng = new Array(); var aMarCap = new Array(); var i = 0; var id = $M("."+frontPageGoogleMapMarker.APP_NAME+"_location_wrap").children("div").size(); $.each($M("input[name=\'"+frontPageGoogleMapMarker.APP_NAME+"_marker[]\']"), function(){ idx = $(this).val(); strid += "+"+idx; location_str = strid.substr(1); locations = location_str.split("+"); $.each(locations, function(index){ aLocation = locations[index].split("("); aLocation.loc = aLocation[0]; aLocation.latlng = aLocation[1]; aLatlng = aLocation.latlng.split(","); lat = parseFloat(aLatlng[0]); lng = parseFloat(aLatlng[1]); lng_len = aLatlng[2].length; marker = aLatlng[2].substr(0,lng_len-1); sData[i] = {lat: lat, lng: lng,loc: aLocation.loc,marker: marker}; }); i++; }); return sData; }, /*give the position for the controllers*/ position_option: function(val){ switch(val) { case "1": pos = google.maps.ControlPosition.TOP_RIGHT; break; case "2": pos = google.maps.ControlPosition.TOP_CENTER; break; case "3": pos = google.maps.ControlPosition.LEFT_TOP; break; case "4": pos = google.maps.ControlPosition.LEFT_CENTER; break; case "5": pos = google.maps.ControlPosition.LEFT_BOTTOM; break; case "6": pos = google.maps.ControlPosition.RIGHT_TOP; break; case "7": pos = google.maps.ControlPosition.RIGHT_CENTER; break; case "8": pos = google.maps.ControlPosition.RIGHT_BOTTOM; break; case "9": pos = google.maps.ControlPosition.BOTTOM_LEFT; break; case "10": pos = google.maps.ControlPosition.BOTTOM_RIGHT; break; case "11": pos = google.maps.ControlPosition.BOTTOM_CENTER; break; default: pos = google.maps.ControlPosition.TOP_LEFT; } return pos; } }; frontPageGoogleMapMarker.initialize(); }); '; $this->writeJs($sJs); }
protected function init_js($aArgs) { $sJs = ' sdk_Module("' . usbuilder()->getModuleSelector() . '").ready(function($M){ var Googlemap = { /*global variables*/ map : null, /* * create the map object and display in map_canvas */ map_init : function(myOptions){ Googlemap.map = new google.maps.Map($M(".map_canvas").get(0), myOptions); }, marker_init: function(locations,lat,lng, bFunc){ /*image*/ var image_icon = "[IMG]/truliamap_icon.png"; Googlemap.markers = new google.maps.Marker({ position: new google.maps.LatLng(lat,lng), map: Googlemap.map, title: locations, clickable: true, draggable: true, icon: image_icon }); if(bFunc == 1){ /*Show infowindow on mouseove*/ var url = frontPageTruliamap.show(locations); var infowindow = new google.maps.InfoWindow({ content: "<div class=\'truliamap_infowindow_div\' ><iframe frameBorder=0 class=\'truliamap_frame_infowindow\' src=\'"+url+"\' ></iframe></div>" }); google.maps.event.addListener(Googlemap.markers, \'click\', function(){ infowindow.open(Googlemap.map,this); }); } } }; var frontPageTruliamap = { APP_NAME: "truliamap", initialize: function(){ var iMapWidth = $M(".map_canvas").parent().width(); var iMapHeight = $M(".map_canvas").parent().height(); var iMinheigth = 200; if(iMapHeight == 0){ iMapHeight = iMinheigth; } $M(".map_canvas").css("width",iMapWidth); $M(".map_canvas").css("height",iMapHeight); frontPageTruliamap.create_map(); }, create_map: function(){ var iLat = $M("."+frontPageTruliamap.APP_NAME+"_lat").val(); var iLng = $M("."+frontPageTruliamap.APP_NAME+"_lng").val(); /*get the maptype*/ var map_type = $M("."+frontPageTruliamap.APP_NAME+"_maptype").val(); switch(map_type){ case "Normal": maptype = google.maps.MapTypeId.ROADMAP; break; case "Satellite": maptype = google.maps.MapTypeId.SATELLITE; break; case "Hybrid": maptype = google.maps.MapTypeId.HYBRID; break; case "Terrain": maptype = google.maps.MapTypeId.TERRAIN; break; } var zoom = $M("."+frontPageTruliamap.APP_NAME+"_zoom").val(); var myOptions = { disableDefaultUI: true, panControl: false, zoom: parseInt(zoom), center: new google.maps.LatLng(iLat ,iLng), mapTypeId: maptype, scaleControl: true, mapTypeControl: true, streetViewControl: true, zoomControl: true, zoomControlOptions: { style: "small" } } Googlemap.map_init(myOptions); var aCity = frontPageTruliamap.get_locations(); $.each(aCity, function(key, val){ Googlemap.marker_init(val.loc,val.lat,val.lng, 1); }); }, get_locations: function(){ var strid = ""; var lat; var lng; var lng_len; var marker; var location_str; var idx; var locations = new Array(); var sData = new Array; var aLocation = new Array(); var aLatlng = new Array(); var aMarCap = new Array(); var i = 0; var id = $M("."+frontPageTruliamap.APP_NAME+"_location_wrap").children("div").size(); $.each($M("input[name=\'"+frontPageTruliamap.APP_NAME+"_marker[]\']"), function(){ idx = $M(this).val(); strid += "+"+idx; location_str = strid.substr(1); locations = location_str.split("+"); $.each(locations, function(index){ aLocation = locations[index].split("("); aLocation.loc = aLocation[0]; aLocation.latlng = aLocation[1]; aLatlng = aLocation.latlng.split(","); lat = parseFloat(aLatlng[0]); lng = parseFloat(aLatlng[1]); sData[i] = {lat: lat, lng: lng,loc: aLocation.loc}; }); i++; }); return sData; }, show: function(location){ var type = $M("."+frontPageTruliamap.APP_NAME+"_type").val(); var loc = location.split(","); var price_to = $M("."+frontPageTruliamap.APP_NAME+"_price_to").val(); var price_from = $M("."+frontPageTruliamap.APP_NAME+"_price_from").val(); var speed = $M("."+frontPageTruliamap.APP_NAME+"_speed").val(); var bed = $M("."+frontPageTruliamap.APP_NAME+"_bed").val(); var bath = $M("."+frontPageTruliamap.APP_NAME+"_bath").val(); var show = $M("."+frontPageTruliamap.APP_NAME+"_show").val(); var size = $M("."+frontPageTruliamap.APP_NAME+"_size").val(); if(type == "map"){ size = 180; } var url = ""; url += "http://www.trulia.com/tools/slideshow/?mode=preview"; url += "&state="+$.trim(loc[1]); url += "&city="+$.trim(loc[0]); url += "&style=default"+size; url += "&tpl_uri=for_sale"; url += "/"+$.trim(location); if(price_from == "0" || parseInt(price_to) > parseInt(price_from)) price_from = price_to; if(price_to != "0" && price_from != "0") url += "/"+price_to+"-"+price_from+"_price"; if(bed != "0") url += "/"+bed+"p_beds"; if(bath != "0") url += "/"+bath+"p_baths"; url += "/&city_uri="+$.trim(loc[0]); url += "&tpl_width="+size; url += "&refresh_speed="+speed; url += "&user_id="+show; if(type == "map"){ return url; } var iMapWidth = $M("."+frontPageTruliamap.APP_NAME+"_design_container").parent().width(); var iMapHeight = $M("."+frontPageTruliamap.APP_NAME+"_design_container").parent().height(); var iMinheigth = 200; if(iMapHeight == 0){ iMapHeight = iMinheigth; } $M("."+frontPageTruliamap.APP_NAME+"_design_container").css("width",iMapWidth); $M("."+frontPageTruliamap.APP_NAME+"_design_container").css("height",iMapHeight); $M("."+frontPageTruliamap.APP_NAME+"_design_container").html("<iframe style=\'width:"+iMapWidth+"px;height:"+iMapHeight+"px;\' frameBorder=0 class=\'"+frontPageTruliamap.APP_NAME+"_frame\' src=\'"+url+"\' ></iframe>"); } }; var agree_flag = $M("."+frontPageTruliamap.APP_NAME+"_agree_flag").val(); if(agree_flag == 1){ var type = $M("."+frontPageTruliamap.APP_NAME+"_type").val(); switch(type){ case "map": frontPageTruliamap.initialize(); break; case "slide": var aCity = frontPageTruliamap.get_locations(); frontPageTruliamap.show(aCity[0].loc); break; case "calc": var size = $M("."+frontPageTruliamap.APP_NAME+"_size").val(); var url= ""; url += "http://www.trulia.com/tools/calculator/?mode=preview"; url += "&graph=&title=title_Mortgage_Calculator"; url += "&style=default"+size; url += "&tpl_style=default"+size; url += "&tpl_width="+size; url += "&calculator_uri=mortgage/calculator/payment/&"; var iMapWidth = $M("."+frontPageTruliamap.APP_NAME+"_design_container").parent().width(); var iMapHeight = $M("."+frontPageTruliamap.APP_NAME+"_design_container").parent().height(); var iMinheigth = 200; if(iMapHeight == 0){ iMapHeight = iMinheigth; } $M("."+frontPageTruliamap.APP_NAME+"_design_container").css("width",iMapWidth); $M("."+frontPageTruliamap.APP_NAME+"_design_container").css("height",iMapHeight); $M("."+frontPageTruliamap.APP_NAME+"_design_container").html("<iframe style=\'width:"+iMapWidth+"px;height:"+iMapHeight+"px;\' frameBorder=0 class=\'"+frontPageTruliamap.APP_NAME+"_frame\' src=\'"+url+"\' ></iframe>"); break; } }else{ $M("body").prepend(\'<div class="\'+frontPageTruliamap.APP_NAME+\'_err" />\'); var sErr_Mess = "You must agree in Trulia\'s terms & conditions to use the widgets."; $M("."+frontPageTruliamap.APP_NAME+"_err").html(sErr_Mess); } });'; $this->writeJs($sJs); }