本文整理汇总了PHP中uriGenerate函数的典型用法代码示例。如果您正苦于以下问题:PHP uriGenerate函数的具体用法?PHP uriGenerate怎么用?PHP uriGenerate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uriGenerate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMigration
function getMigration()
{
$this->setResultStatus('The transfer was started.');
mysql_query('SET NAMES utf8', $this->rOldDb);
$sSql = "SELECT \r\n \t\t\t`ID` AS `id`, \r\n \t\t\t`Sender` AS `author_id`, \r\n \t\t\t`Header` AS `caption`,\r\n \t\t\t`Text` AS `content`,\r\n \t\t\t'' AS `uri`,\r\n \t\t\t'' AS `tags`, \r\n \t\t\t'3' AS `allow_comment_to`,\r\n \t\t\t'3' AS `allow_vote_to`,\r\n \t\t\t`Date` AS `date`,\r\n \t\t\t`Active` AS `status`,\r\n \t\t\t'0' AS `rate`,\r\n \t\t\t'0' AS `rate_count`,\r\n \t\t\t'0' AS `cmts_count`\r\n \t\tFROM `Stories`";
$rResult = mysql_query($sSql, $this->rOldDb);
$iCount = mysql_num_rows($rResult);
while ($aFeedback = mysql_fetch_assoc($rResult)) {
$aFeedback['uri'] = uriGenerate($aFeedback['caption'], $this->oDolModule->_oDb->getPrefix() . 'entries', 'uri');
$aFeedback['status'] = $aFeedback['status'] == 'on' ? 0 : 1;
if ($this->exists($aFeedback['id'], $aFeedback['uri'])) {
$this->setResultStatus('Duplicate data. Feedback with similar info already exists.');
return MIGRATION_FAILED;
}
$sSql = "INSERT INTO `" . $this->oDolModule->_oDb->getPrefix() . "entries` SET";
foreach ($aFeedback as $sKey => $sValue) {
$sSql .= " `" . $sKey . "`='" . $this->oMigrationModule->_oDb->escape($sValue) . "',";
}
$iResult = (int) $this->oDolModule->_oDb->query(substr($sSql, 0, -1));
if ($iResult <= 0) {
$this->setResultStatus('Database error. Cannot insert data in the database.');
return MIGRATION_FAILED;
}
}
$this->setResultStatus('The transfer was successfully completed. (' . $iCount . ' items)');
return MIGRATION_SUCCESSFUL;
}
示例2: transferContent
function transferContent()
{
$sSql = "SELECT \r\n \t\t\t`ta`.`ArticlesID` AS `id`,\r\n \t\t\t`ta`.`ownerID` AS `author_id`,\r\n \t\t\t`ta`.`Title` AS `caption`,\r\n \t\t\t`ta`.`Text` AS `content`,\r\n \t\t\t`ta`.`ArticleUri` AS `uri`,\r\n \t\t\t'' AS `tags`, \t\t\t\r\n \t\t\t`tac`.`CategoryName` AS `categories`,\r\n \t\t\t'0' AS `comment`,\r\n \t\t\t'0' AS `vote`,\r\n \t\t\tUNIX_TIMESTAMP(`Date`) AS `date`,\r\n \t\t\t'0' AS `status`,\r\n \t\t\t'0' AS `featured`,\r\n \t\t\t'0' AS `rate`,\r\n \t\t\t'0' AS `rate_count`,\r\n \t\t\t'0' AS `view_count`,\r\n \t\t\t'0' AS `cmts_count`\r\n \t\tFROM `Articles` AS `ta` \r\n \t\tLEFT JOIN `ArticlesCategory` AS `tac` ON `ta`.`CategoryID`=`tac`.`CategoryID`\r\n \t\tORDER BY `Date` ASC";
$rResult = mysql_query($sSql, $this->rOldDb);
$iCount = mysql_num_rows($rResult);
$oCategories = new BxDolCategories();
while ($aItem = mysql_fetch_assoc($rResult)) {
$aItem['uri'] = uriGenerate($aItem['caption'], $this->oDolModule->_oDb->getPrefix() . 'entries', 'uri');
if ($this->existsItem($aItem['id'], $aItem['uri'])) {
$this->setResultStatus('Duplicate data. Article with similar info already exists.');
return MIGRATION_FAILED;
}
$sSql = "INSERT INTO `" . $this->oDolModule->_oDb->getPrefix() . "entries` SET";
foreach ($aItem as $sKey => $sValue) {
$sSql .= " `" . $sKey . "`='" . $this->oMigrationModule->_oDb->escape($sValue) . "',";
}
$iResult = (int) $this->oDolModule->_oDb->query(substr($sSql, 0, -1));
if ($iResult <= 0) {
$this->setResultStatus('Database error. Cannot insert item in the database.');
return MIGRATION_FAILED;
}
$oCategories->reparseObjTags($this->_sType, $this->oDolModule->_oDb->lastId());
}
$this->setResultStatus('The transfer was successfully completed. (' . $iCount . ' items)');
return MIGRATION_SUCCESSFUL;
}
示例3: performActionAdd
public function performActionAdd()
{
$sAction = 'add';
$aForm = array('form_attrs' => array('id' => 'adm-form-pre-list-create', 'action' => BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction, 'method' => BX_DOL_STUDIO_METHOD_DEFAULT), 'params' => array('db' => array('table' => 'sys_form_pre_lists', 'key' => 'id', 'uri' => '', 'uri_title' => '', 'submit_name' => 'do_submit')), 'inputs' => array('module' => array('type' => 'hidden', 'name' => 'module', 'value' => BX_DOL_STUDIO_MODULE_CUSTOM, 'db' => array('pass' => 'Xss')), 'use_for_sets' => array('type' => 'hidden', 'name' => 'use_for_sets', 'value' => 1, 'db' => array('pass' => 'Int')), 'title' => array('type' => 'text_translatable', 'name' => 'title', 'caption' => _t('_adm_form_txt_pre_lists_title'), 'info' => _t('_adm_form_dsc_pre_lists_title'), 'value' => '_adm_form_txt_pre_lists', 'required' => '1', 'db' => array('pass' => 'Xss'), 'checker' => array('func' => 'LengthTranslatable', 'params' => array(3, 100, 'title'), 'error' => _t('_adm_form_err_pre_lists_title'))), 'controls' => array('name' => 'controls', 'type' => 'input_set', array('type' => 'submit', 'name' => 'do_submit', 'value' => _t('_adm_form_btn_pre_lists_add')), array('type' => 'reset', 'name' => 'close', 'value' => _t('_adm_form_btn_pre_lists_cancel'), 'attrs' => array('onclick' => "\$('.bx-popup-applied:visible').dolPopupHide()", 'class' => 'bx-def-margin-sec-left')))));
$oForm = new BxTemplStudioFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
bx_import('BxDolStudioLanguagesUtils');
$oLanguage = BxDolStudioLanguagesUtils::getInstance();
$sLanguage = $oLanguage->getCurrentLangName(false);
$sKey = BxDolForm::getSubmittedValue('title-' . $sLanguage, $aForm['form_attrs']['method']);
$sKey = uriGenerate($sKey, 'sys_form_pre_lists', 'key', 'key');
$iId = (int) $oForm->insert(array('key' => $sKey));
if ($iId != 0) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
} else {
$aRes = array('msg' => _t('_adm_form_err_pre_lists_create'));
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-form-pre-list-create-popup', _t('_adm_form_txt_pre_lists_create_popup'), $this->_oTemplate->parseHtmlByName('form_add_list.html', array('form_id' => $aForm['form_attrs']['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
}
}
示例4: performActionAdd
public function performActionAdd()
{
$sAction = 'add';
$sFormObject = $this->oModule->_oConfig->getObject('form_nav_menu');
$sFormDisplay = $this->oModule->_oConfig->getObject('form_display_nav_menu_add');
bx_import('BxDolForm');
$oForm = BxDolForm::getObjectInstance($sFormObject, $sFormDisplay, $this->oModule->_oTemplate);
$oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction;
$this->fillInSelects($oForm->aInputs);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$sObject = uriGenerate($oForm->getCleanValue('object'), 'sys_objects_menu', 'object', 'object');
BxDolForm::setSubmittedValue('object', $sObject, $oForm->aFormAttrs['method']);
if (($iId = (int) $oForm->insert()) != 0) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
} else {
$aRes = array('msg' => _t('_bx_dev_nav_err_menus_create'));
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-nav-menu-create-popup', _t('_bx_dev_nav_txt_menus_create_popup'), $this->oModule->_oTemplate->parseHtmlByName('nav_add_menu.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
}
}
示例5: getMigration
/**
* Function migrate shared_photos data;
*
* @return : (integer) operation result;
*/
function getMigration()
{
if (!$this->oDolModule) {
$this->setResultStatus('System error: object instance is not received');
return MIGRATION_FAILED;
}
// set new status;
$this->setResultStatus('Shared photos transfer now');
mysql_query('SET NAMES utf8', $this->rOldDb);
$sqlQuery = "SELECT * FROM `{$this->aOldTables['main']}` GROUP BY `medID`";
$rResult = mysql_query($sqlQuery, $this->rOldDb);
while ($aRow = mysql_fetch_assoc($rResult)) {
$sUri = !$this->isEntryExisting($aRow['medUri']) ? $aRow['medUri'] : uriGenerate($aRow['medTitle'], $this->sType . '_main', 'Uri');
$sUri = $this->oMigrationModule->_oDb->escape($sUri);
$aSizeInfo = $this->getSizeInfo($aRow['medID'] . '.' . $aRow['medExt']);
$sSize = $aSizeInfo['width'] . 'x' . $aSizeInfo['height'];
$sStatus = $aRow['Approved'] == 'true' ? 'approved' : 'disapproved';
$sHash = md5(microtime());
// escape all data;
$aRow = $this->escapeData($aRow);
$sqlQuery = "\n\t INSERT INTO \n\t \t`{$this->sType}_main`\n\t SET\n\t\t\t\t\t `Owner` = '{$aRow['medProfId']}',\n\t\t\t\t\t `Ext` = '{$aRow['medExt']}',\n\t\t\t\t\t `Size` = '{$sSize}',\n\t\t\t\t\t `Title` = '{$aRow['medTitle']}',\n\t\t\t\t\t `Uri` = '{$sUri}',\n\t\t\t\t\t `Desc` = '{$aRow['medDesc']}',\n\t\t\t\t\t `Tags` = '{$aRow['medTags']}',\n\t\t\t\t\t `Date` = '{$aRow['medDate']}',\n\t\t\t\t\t `Views` = '{$aRow['medViews']}',\n\t\t\t\t\t `Hash` = '{$sHash}',\n\t\t\t\t\t `Status` = '{$sStatus}'\n ";
$iResult = (int) $this->oMigrationModule->_oDb->query($sqlQuery);
if ($iResult <= 0) {
$this->setResultStatus('Database error. Cannot insert new photo to the database.');
return MIGRATION_FAILED;
}
// get last file id;
$iFileId = $this->oMigrationModule->_oDb->lastId();
//transform the file
$this->_exportFile(array('medID' => $aRow['medID'], 'medFile' => $aRow['medFile'], 'medProfId' => $aRow['medProfId'], 'medExt' => $aRow['medExt'], 'newID' => $iFileId));
$oTag = new BxDolTags();
$oTag->reparseObjTags($this->sType, $iFileId);
// define album
$sError = $this->_defineAlbum($iFileId, $aRow['medProfId'], $aRow['medTitle']);
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
$sError = $this->_exportFavorites(array('old' => $aRow['medID'], 'new' => $iFileId));
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
$sError = $this->_exportVotings(array('old' => $aRow['medID'], 'new' => $iFileId));
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
$sError = $this->_exportComments(array('old' => $aRow['medID'], 'new' => $iFileId));
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
}
// set as finished;
$this->setResultStatus('All photos were transferred');
return MIGRATION_SUCCESSFUL;
}
示例6: getMigration
/**
* Function migrate profile photos data;
*
* @return : (integer) operation result;
*/
function getMigration()
{
if (!$this->oDolModule) {
$this->setResultStatus('System error: object instance is not received');
return MIGRATION_FAILED;
}
// set new status;
$this->setResultStatus('Profile Photos are transfered now');
mysql_query('SET NAMES utf8', $this->rOldDb);
$sqlQuery = "SELECT `med_id` as `medID`,\n \t\t\t\t\t`med_prof_id` as `medProfId`,\n \t\t\t\t\t`med_file` as `medFile`,\n \t\t\t\t\t`med_title` as `medTitle`,\n \t\t\t\t\tif(`med_status`='active', 'approved', 'disapproved') as `medStatus`,\n \t\t\t\t\tUNIX_TIMESTAMP(`med_date`) as `medDate`\n \t\t\t\t\tFROM `{$this->aOldTables['main']}` WHERE `med_type`='photo' GROUP BY `med_id`";
$rResult = mysql_query($sqlQuery, $this->rOldDb);
if ($rResult) {
while ($aRow = mysql_fetch_assoc($rResult)) {
if (!$this->isEntryExisting($aRow['medID'])) {
// escape all data;
$aRow = $this->escapeData($aRow);
$aRow['medExt'] = substr($aRow['medFile'], strpos($aRow['medFile'], '.') + 1);
$aSizeInfo = $this->getSizeInfo('photo_' . $aRow['medFile'], $aRow['medProfId']);
$sUri = uriGenerate($aRow['medTitle'], $this->sType . '_main', 'Uri');
$sSize = $aSizeInfo['width'] . 'x' . $aSizeInfo['height'];
$sHash = md5(microtime());
//transform the file
if (!$this->_exportFile(array('medID' => $aRow['medID'], 'medFile' => $aRow['medFile'], 'medProfId' => $aRow['medProfId'], 'medExt' => $aRow['medExt']))) {
continue;
}
$sqlQuery = "\n\t \tINSERT INTO \n\t \t\t`{$this->sType}_main`\n\t \tSET\n\t \t\t `ID` = {$aRow['medID']},\n\t\t\t\t\t\t `Owner` = '{$aRow['medProfId']}',\n\t\t\t\t\t\t `Ext` = '{$aRow['medExt']}',\n\t\t\t\t\t\t `Size` = '{$sSize}',\n\t\t\t\t\t\t `Title` = '{$aRow['medTitle']}',\n\t\t\t\t\t\t `Uri` = '{$sUri}',\n\t\t\t\t\t\t `Desc` = '{$aRow['medDesc']}',\n\t\t\t\t\t\t `Tags` = '{$aRow['medTags']}',\n\t\t\t\t\t\t `Date` = '{$aRow['medDate']}',\n\t\t\t\t\t\t `Views` = '{$aRow['medViews']}',\n\t\t\t\t\t\t `Hash` = '{$sHash}',\n\t\t\t\t\t\t `Status` = '{$aRow['medStatus']}'\n\t ";
$iResult = (int) $this->oMigrationModule->_oDb->query($sqlQuery);
if ($iResult <= 0) {
$this->setResultStatus('Database error. Cannot insert new photo to the database.');
return MIGRATION_FAILED;
}
// define album
$sError = $this->_defineAlbum($aRow['medID'], $aRow['medProfId'], $aRow['medTitle']);
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
$sError = $this->_exportVotings($aRow['medID']);
if ($sError) {
$this->setResultStatus($sError);
return MIGRATION_FAILED;
}
} else {
$this->setResultStatus('Duplicate data. Photo with similar info already exists (remove all photos and start again)');
return MIGRATION_FAILED;
}
}
}
// set as finished;
$this->setResultStatus('All photos were transferred');
return MIGRATION_SUCCESSFUL;
}
示例7: performActionAdd
public function performActionAdd()
{
$sAction = 'add';
$oForm = $this->_getFormObject($sAction);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
if (!empty($_FILES['icon_image']['tmp_name'])) {
bx_import('BxDolStorage');
$oStorage = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES);
$mixedIcon = $oStorage->storeFileFromForm($_FILES['icon_image'], false, 0);
if ($mixedIcon === false) {
$this->_echoResultJson(array('msg' => _t('_adm_nav_err_items_icon_image') . $oStorage->getErrorString()), true);
return;
}
$oStorage->afterUploadCleanup($mixedIcon, 0);
BxDolForm::setSubmittedValue('icon', $mixedIcon, $oForm->aFormAttrs['method']);
}
bx_import('BxDolPermalinks');
$oPermalinks = BxDolPermalinks::getInstance();
$sLink = $oForm->getCleanValue('link');
$sLink = $oPermalinks->unpermalink($sLink);
BxDolForm::setSubmittedValue('link', $sLink, $oForm->aFormAttrs['method']);
$sName = $oPermalinks->getPageNameFromLink($sLink);
if ($sName == '') {
bx_import('BxDolStudioLanguagesUtils');
$sLanguage = BxDolStudioLanguagesUtils::getInstance()->getCurrentLangName(false);
$sName = BxDolForm::getSubmittedValue('title_system-' . $sLanguage, $oForm->aFormAttrs['method']);
$sName = uriGenerate($sName, 'sys_menu_items', 'name', 'item');
}
$sSubmenu = $oForm->getCleanValue('submenu_object');
if (!empty($sSubmenu)) {
$sLink = $oForm->getCleanValue('link');
if (empty($sLink)) {
BxDolForm::setSubmittedValue('link', 'javascript:void(0)', $oForm->aFormAttrs['method']);
}
BxDolForm::setSubmittedValue('target', '', $oForm->aFormAttrs['method']);
BxDolForm::setSubmittedValue('onclick', 'bx_menu_popup(\'' . $sSubmenu . '\', this);', $oForm->aFormAttrs['method']);
}
$iId = (int) $oForm->insert(array('module' => BX_DOL_STUDIO_MODULE_CUSTOM, 'name' => $sName, 'active' => 1, 'order' => $this->oDb->getItemOrderMax($this->sSet) + 1));
if ($iId != 0) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
} else {
$aRes = array('msg' => _t('_adm_nav_err_items_create'));
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-nav-item-create-popup', _t('_adm_nav_txt_items_create_popup'), $this->_oTemplate->parseHtmlByName('nav_add_item.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
}
}
示例8: performActionAdd
public function performActionAdd()
{
$sAction = 'add';
$sFormObject = $this->oModule->_oConfig->getObject('form_forms_display');
$sFormDisplay = $this->oModule->_oConfig->getObject('form_display_forms_display_add');
$oForm = BxDolForm::getObjectInstance($sFormObject, $sFormDisplay, $this->oModule->_oTemplate);
$this->_fillDisplayForm($oForm, $sAction);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$sName = uriGenerate($oForm->getCleanValue('display_name'), 'sys_form_displays', 'display_name', 'display');
BxDolForm::setSubmittedValue('display_name', $sName, $oForm->aFormAttrs['method']);
if (($iId = (int) $oForm->insert()) != 0) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
} else {
$aRes = array('msg' => _t('_bx_dev_frm_err_displays_create'));
}
$this->_echoResultJson($aRes, true);
} else {
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-display-create-popup', _t('_bx_dev_frm_txt_displays_create_popup'), $this->_oTemplate->parseHtmlByName('form_add_display.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
}
}
示例9: performActionAdd
public function performActionAdd()
{
$sAction = 'add';
$oForm = $this->_getFormObject($sAction);
if ($oForm->isSubmitted() && isset($oForm->aInputs['set_name'])) {
$this->updateSetFields($oForm);
}
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
bx_import('BxDolStudioLanguagesUtils');
$oLanguage = BxDolStudioLanguagesUtils::getInstance();
$sLanguage = $oLanguage->getCurrentLangName(false);
$sObject = BxDolForm::getSubmittedValue('title-' . $sLanguage, $oForm->aFormAttrs['method']);
$sObject = uriGenerate($sObject, 'sys_objects_menu', 'object', 'object');
//--- New Set Creation
if ($oForm->getCleanValue('set_name') == $this->sCreateNew) {
$sSetTitleValue = $oForm->getCleanValue('set_title');
$sSetName = uriGenerate($sSetTitleValue, 'sys_menu_sets', 'set_name', 'set');
$sSetTitleKey = '_adm_nav_txt_set_' . $sSetName;
if ($this->oDb->addSet(array('set_name' => $sSetName, 'module' => BX_DOL_STUDIO_MODULE_CUSTOM, 'title' => $sSetTitleKey, 'deletable' => 1))) {
$oLanguage->addLanguageString($sSetTitleKey, $sSetTitleValue);
BxDolForm::setSubmittedValue('set_name', $sSetName, $oForm->aFormAttrs['method']);
}
}
unset($oForm->aInputs['set_title']);
$iId = (int) $oForm->insert(array('object' => $sObject, 'module' => BX_DOL_STUDIO_MODULE_CUSTOM, 'deletable' => 1, 'active' => 1));
if ($iId != 0) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
} else {
$aRes = array('msg' => _t('_adm_nav_err_menus_create'));
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('adm-nav-menu-create-popup', _t('_adm_nav_txt_menus_create_popup'), $this->_oTemplate->parseHtmlByName('nav_add_menu.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
}
}
示例10: performActionAdd
public function performActionAdd()
{
$sAction = 'add';
$sFormObject = $this->oModule->_oConfig->getObject('form_forms_prelist');
$sFormDisplay = $this->oModule->_oConfig->getObject('form_display_forms_prelist_add');
$oForm = BxDolForm::getObjectInstance($sFormObject, $sFormDisplay, $this->oModule->_oTemplate);
$oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction;
$oForm->aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_frm_txt_select_module')), BxDolStudioUtils::getModules());
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$sObject = uriGenerate($oForm->getCleanValue('key'), 'sys_form_pre_lists', 'key', 'key');
BxDolForm::setSubmittedValue('key', $sObject, $oForm->aFormAttrs['method']);
if (($iId = (int) $oForm->insert()) != 0) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $iId);
} else {
$aRes = array('msg' => _t('_bx_dev_frm_err_prelists_create'));
}
$this->_echoResultJson($aRes, true);
} else {
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-frm-prelist-create-popup', _t('_bx_dev_frm_txt_prelists_create_popup'), $this->oModule->_oTemplate->parseHtmlByName('form_add_list.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
}
}
示例11: performActionAdd
public function performActionAdd()
{
$sAction = 'add';
bx_import('BxDolForm');
$oForm = BxDolForm::getObjectInstance('mod_dev_nav_set', 'mod_dev_nav_set_add');
$oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . 'grid.php?o=' . $this->_sObject . '&a=' . $sAction;
$oForm->aInputs['module']['values'] = array_merge(array('' => _t('_bx_dev_nav_txt_select_module')), BxDolStudioUtils::getModules());
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$sName = uriGenerate($oForm->getCleanValue('set_name'), 'sys_menu_sets', 'set_name', 'set');
BxDolForm::setSubmittedValue('set_name', $sName, $oForm->aFormAttrs['method']);
if ($oForm->insert() !== false) {
$aRes = array('grid' => $this->getCode(false), 'blink' => $sName);
} else {
$aRes = array('msg' => _t('_bx_dev_nav_err_sets_create'));
}
$this->_echoResultJson($aRes, true);
} else {
bx_import('BxTemplStudioFunctions');
$sContent = BxTemplStudioFunctions::getInstance()->popupBox('bx-dev-nav-set-create-popup', _t('_bx_dev_nav_txt_sets_create_popup'), $this->_oTemplate->parseHtmlByName('nav_add_set.html', array('form_id' => $oForm->aFormAttrs['id'], 'form' => $oForm->getCode(true), 'object' => $this->_sObject, 'action' => $sAction)));
$this->_echoResultJson(array('popup' => array('html' => $sContent, 'options' => array('closeOnOuterClick' => false))), true);
}
}
示例12: generateUri
function generateUri()
{
$f =& $this->aParams['db'];
$sUri = $this->getCleanValue($f['uri_title']);
return uriGenerate($sUri, $f['table'], $f['uri']);
}
示例13: getAddSubcatForm
function getAddSubcatForm($iSubCategoryID = 0, $bOnlyForm = false)
{
//admin side only
$sSubmitC = _t('_bx_ads_add_subcategory');
$sAction = 'add_sub_category';
$aParentCategories = array();
$vParentValues = $this->_oDb->getAllCatsInfo();
while ($aCategInfo = mysql_fetch_assoc($vParentValues)) {
$iID = $aCategInfo['ID'];
$sName = $aCategInfo['Name'];
$aParentCategories[$iID] = $sName;
}
$sTitle = $sDescription = '';
$iParentID = 0;
if ($iSubCategoryID) {
$aSubcatInfos = $this->_oDb->getSubcatInfo($iSubCategoryID);
$sTitle = $aSubcatInfos[0]['NameSub'];
$sDescription = $aSubcatInfos[0]['Description'];
$iParentID = (int) $aSubcatInfos[0]['IDClassified'];
}
//adding form
$aForm = array('form_attrs' => array('name' => 'create_sub_cats_form', 'action' => 'javascript: void(0)', 'method' => 'post'), 'params' => array('db' => array('table' => $this->_oConfig->sSQLSubcatTable, 'key' => 'ID', 'submit_name' => 'add_button')), 'inputs' => array('action' => array('type' => 'hidden', 'name' => 'action', 'value' => $sAction), 'IDClassified' => array('type' => 'select', 'name' => 'IDClassified', 'caption' => _t('_bx_ads_parent_category'), 'values' => $aParentCategories, 'value' => $iParentID, 'db' => array('pass' => 'Int')), 'NameSub' => array('type' => 'text', 'name' => 'NameSub', 'caption' => _t('_Title'), 'required' => true, 'value' => $sTitle, 'checker' => array('func' => 'length', 'params' => array(3, 128), 'error' => _t('_bx_ads_title_error_desc', 128)), 'db' => array('pass' => 'Xss')), 'Description' => array('type' => 'text', 'name' => 'Description', 'caption' => _t('_Description'), 'value' => $sDescription, 'db' => array('pass' => 'Xss')), 'add_button' => array('type' => 'submit', 'name' => 'add_button', 'value' => $sSubmitC, 'attrs' => array('onClick' => "AdmCreateSubcategory('{$this->sHomeUrl}{$this->sCurrBrowsedFile}'); return false;"))));
if ($iSubCategoryID) {
$aForm['inputs']['hidden_postid'] = array('type' => 'hidden', 'name' => 'id', 'value' => $iSubCategoryID);
}
$sCode = '';
$sJS = $this->_oTemplate->addJs('main.js', true);
$oForm = new BxTemplFormView($aForm);
$oForm->initChecker();
if ($oForm->isSubmittedAndValid()) {
$aValsAdd = array();
if ($iSubCategoryID == 0) {
$sCategUri = uriGenerate(bx_get('NameSub'), $this->_oConfig->sSQLSubcatTable, 'SEntryUri');
$aValsAdd['SEntryUri'] = $sCategUri;
}
$iLastId = -1;
if ($iSubCategoryID > 0) {
$oForm->update($iSubCategoryID, $aValsAdd);
$iLastId = $iSubCategoryID;
} else {
$iLastId = $oForm->insert($aValsAdd);
}
if ($iLastId > 0) {
$sCode = MsgBox(_t('_bx_ads_Sub_category_successfully_added'), 3);
} else {
$sCode = MsgBox(_t('_bx_ads_Sub_category_failed_add'), 3);
}
}
if ($bOnlyForm) {
return $sCode . $oForm->getCode();
}
$sResult = $sJS . $sCode . $oForm->getCode();
if (bx_get('mode') == 'json') {
require_once BX_DIRECTORY_PATH_PLUGINS . 'Services_JSON.php';
$oJson = new Services_JSON();
return $oJson->encode($sResult);
exit;
}
$sResult = $this->_oTemplate->parseHtmlByName('default_margin.html', array('content' => $sResult));
return $GLOBALS['oFunctions']->popupBox('ads_add_sub_category', _t('_bx_ads_add_subcategory'), $sResult);
}
示例14: registerMember
function registerMember()
{
$oPC = new BxDolProfilesController();
$oZ = new BxDolAlerts('profile', 'before_join', 0, 0, $this->aValues[0]);
$oZ->alert();
$aProfile1 = $this->oPF->getProfileFromValues($this->aValues[0]);
if (empty($aProfile1['NickName'])) {
$aProfile1['NickName'] = uriGenerate(empty($aProfile1['FirstName']) ? genRndPwd(10, false) : $aProfile1['FirstName'], 'Profiles', 'NickName');
}
list($iId1, $sStatus1) = $oPC->createProfile($aProfile1);
//--- check whether profile was created successfully or not
if (!$iId1) {
if (isset($aProfile1['ProfilePhoto']) && !empty($aProfile1['ProfilePhoto'])) {
@unlink($GLOBALS['dir']['tmp'] . $aProfile1['ProfilePhoto']);
}
return array(false, 'Fail');
}
//--- check for couple profile
if ($this->bCouple) {
$aProfile2 = $this->oPF->getProfileFromValues($this->aValues[1]);
list($iId2, $sStatus2) = $oPC->createProfile($aProfile2, false, $iId1);
if (!$iId2) {
$oPC->deleteProfile($iId1);
return array(false, 'Fail');
}
}
//--- upload profile photo
if (isset($aProfile1['ProfilePhoto']) && !empty($aProfile1['ProfilePhoto'])) {
$sPass1 = getPassword($iId1);
bx_login($iId1);
check_logged();
BxDolService::call('avatar', 'set_image_for_cropping', array($iId1, $GLOBALS['dir']['tmp'] . $aProfile1['ProfilePhoto']));
if (BxDolRequest::serviceExists('photos', 'perform_photo_upload', 'Uploader')) {
$aFileInfo = array('medTitle' => _t('_sys_member_thumb_avatar'), 'medDesc' => _t('_sys_member_thumb_avatar'), 'medTags' => _t('_ProfilePhotos'), 'Categories' => array(_t('_ProfilePhotos')), 'album' => str_replace('{nickname}', getUsername($iId1), getParam('bx_photos_profile_album_name')), 'albumPrivacy' => BX_DOL_PG_ALL);
BxDolService::call('photos', 'perform_photo_upload', array($GLOBALS['dir']['tmp'] . $aProfile1['ProfilePhoto'], $aFileInfo, false), 'Uploader');
}
}
if (BxDolModule::getInstance('BxWmapModule')) {
BxDolService::call('wmap', 'response_entry_add', array('profiles', $iId1));
}
//--- create system event
bx_import('BxDolAlerts');
$oZ = new BxDolAlerts('profile', 'join', $iId1, 0, array('status_text' => &$sStatus1));
$oZ->alert();
return array($iId1, $sStatus1);
}
示例15: InsertCS
/**
* SQL Inserting new SubClassifieds
*
* @param $sCategoryID Added CategoryID FIeld value
* @param $sName Added Name FIeld value
* @param $sDescription Added Description FIeld value
* @return SQL result
*/
function InsertCS($sCategoryID, $sName, $sDescription)
{
$sNewUri = uriGenerate($sName, 'ClassifiedsSubs', 'SEntryUri', 128);
$query = "INSERT INTO `ClassifiedsSubs` SET\r\n\t\t\t\t\t`IDClassified`='{$sCategoryID}',\r\n\t\t\t\t\t`NameSub`='{$sName}',\r\n\t\t\t\t\t`SEntryUri`='{$sNewUri}',\r\n\t\t\t\t\t`Description`='{$sDescription}'";
$sqlRes = db_res($query);
return $sqlRes;
}