本文整理汇总了PHP中DBUtil::selectObject方法的典型用法代码示例。如果您正苦于以下问题:PHP DBUtil::selectObject方法的具体用法?PHP DBUtil::selectObject怎么用?PHP DBUtil::selectObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBUtil
的用法示例。
在下文中一共展示了DBUtil::selectObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: userOnline
/**
* @param int args[uid] userid
*/
public function userOnline($args)
{
$uid = $args['uid'];
$tables = DBUtil::getTables();
$columns = $tables['session_info_column'];
$where = "{$columns['uid']} = '" . DataUtil::formatForStore($uid) . "'";
return DBUtil::selectObject('session_info', $where);
}
示例2: smarty_block_muboardform
/**
* Smarty function to wrap MUBoard_Form_View generated form controls with suitable form tags.
*
* @param array $params Parameters passed in the block tag.
* @param string $content Content of the block.
* @param Zikula_Form_View $view Reference to Zikula_Form_View object.
*
* @return string The rendered output.
*/
function smarty_block_muboardform($params, $content, $view)
{
if ($content) {
PageUtil::addVar('stylesheet', 'system/Theme/style/form/style.css');
$encodingHtml = array_key_exists('enctype', $params) ? " enctype=\"{$params['enctype']}\"" : '';
$action = htmlspecialchars(System::getCurrentUri());
$classString = '';
if (isset($params['cssClass'])) {
$classString = "class=\"{$params['cssClass']}\" ";
}
$request = new Zikula_Request_Http();
$id = $request->getGet()->filter('id', 0, FILTER_SANITIZE_NUMBER_INT);
$forumid = $request->getGet()->filter('forum', 0, FILTER_SANITIZE_NUMBER_INT);
// we check if the entrypoint is part of the url
$stripentrypoint = ModUtil::getVar('ZConfig', 'shorturlsstripentrypoint');
// get url name
$tables = DBUtil::getTables();
$modcolumn = $tables['modules_column'];
$module = 'MUBoard';
$where = "{$modcolumn['name']} = '" . DataUtil::formatForStore($module) . "'";
$module = DBUtil::selectObject('modules', $where);
$urlname = $module['url'];
if (ModUtil::getVar('ZConfig', 'shorturls') == 0) {
if (strpos($action, "func=display") !== false) {
$action = 'index.php?module=' . $urlname . '&type=user&func=edit&ot=posting&answer=1';
}
if (strpos($action, "func=edit&ot=posting") !== false && $forumid > 0) {
$action = 'index.php?module=' . $urlname . '&type=user&func=edit&ot=posting&forum' . $forumid;
}
} else {
if (strpos($action, $urlname . "/posting/id.") !== false) {
if ($stripentrypoint == 1) {
$action = $urlname . '/edit/ot/posting/answer/1';
} elseif ($stripentrypoint == 0) {
$action = 'index.php/' . $urlname . '/edit/ot/posting/answer/1';
}
}
if (strpos($action, "edit/ot/posting/forum/") !== false && $forumid > 0) {
if ($stripentrypoint == 1) {
$action = $urlname . '/edit/ot/posting/forum/' . $forumid;
} elseif ($stripentrypoint == 0) {
$action = 'index.php/' . $urlname . '/edit/ot/posting/forum/' . $forumid;
}
}
}
$view->postRender();
$formId = $view->getFormId();
$out = "\n <form id=\"{$formId}\" {$classString}action=\"{$action}\" method=\"post\"{$encodingHtml}>\n {$content}\n <div>\n {$view->getStateHTML()}\n {$view->getStateDataHTML()}\n {$view->getIncludesHTML()}\n {$view->getCsrfTokenHtml()}\n <input type=\"hidden\" name=\"__formid\" id=\"form__id\" value=\"{$formId}\" />\n <input type=\"hidden\" name=\"FormEventTarget\" id=\"FormEventTarget\" value=\"\" />\n <input type=\"hidden\" name=\"FormEventArgument\" id=\"FormEventArgument\" value=\"\" />\n <script type=\"text/javascript\">\n <!--\n function FormDoPostBack(eventTarget, eventArgument)\n {\n var f = document.getElementById('{$formId}');\n if (!f.onsubmit || f.onsubmit())\n {\n f.FormEventTarget.value = eventTarget;\n f.FormEventArgument.value = eventArgument;\n f.submit();\n }\n }\n // -->\n </script>\n </div>\n </form>\n ";
return $out;
}
}
示例3: validatePostProcess
public function validatePostProcess($type = 'user', $data = null)
{
$data = $this->_objData;
if ($data['modname'] && $data['table'] && $data['property'] && (!isset($data['id']) || !$data['id'])) {
$where = "WHERE modname='{$data['modname']}' AND entityname='{$data['table']}' AND property='{$data['property']}'";
$row = DBUtil::selectObject($this->_objType, $where);
if ($row) {
$_SESSION['validationErrors'][$this->_objPath]['property'] = __('Error! There is already a property with this name in the specified module and table.');
$_SESSION['validationFailedObjects'][$this->_objPath] = $this->_objData;
return false;
}
}
return true;
}
示例4: get_hour
public function get_hour($args) {
$hid = FormUtil::getPassedValue('hid', isset($args['hid']) ? $args['hid'] : null, 'GET');
if (!isset($hid) || !is_numeric($hid)) {
return LogUtil::registerError($this->__('Error! Could not do what you wanted. Please check your input.'));
}
$tablename = 'IWtimeframes';
$where = "hid =" . $hid;
$item = DBUtil::selectObject($tablename, $where);
if (!empty($item)) {
return $item;
} else {
return false;
}
}
示例5: get
/**
* get a specific item
* @author Mark West
* @param $args['sid'] id of news item to get
* @return mixed item array, or false on failure
*/
public function get($args)
{
// optional arguments
if (isset($args['objectid'])) {
$args['sid'] = $args['objectid'];
}
// Argument check
if ((!isset($args['sid']) || !is_numeric($args['sid'])) &&
!isset($args['title'])) {
return LogUtil::registerArgsError();
}
// Check for caching of the DBUtil calls (needed for AJAX editing)
if (!isset($args['SQLcache'])) {
$args['SQLcache'] = true;
}
// form a date using some ofif present...
// step 1 - convert month name into
if (isset($args['monthname']) && !empty($args['monthname'])) {
$months = explode(' ', $this->__('Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'));
$keys = array_flip($months);
$args['monthnum'] = $keys[ucfirst($args['monthname'])] + 1;
}
// step 2 - convert to a timestamp and back to a db format
if (isset($args['year']) && !empty($args['year']) && isset($args['monthnum']) &&
!empty($args['monthnum']) && isset($args['day']) && !empty($args['day'])) {
// use PHP strftime directly, since DateUtil translates dateformat strings, which is not ok in this case
$timestring = strftime('%Y-%m-%d', mktime(0, 0, 0, $args['monthnum'], $args['day'], $args['year']));
}
$permFilter = array();
$permFilter[] = array('realm' => 0,
'component_left' => 'News',
'component_middle' => '',
'component_right' => '',
'instance_left' => 'cr_uid',
'instance_middle' => '',
'instance_right' => 'sid',
'level' => ACCESS_READ);
if (isset($args['sid']) && is_numeric($args['sid'])) {
$item = DBUtil::selectObjectByID('news', $args['sid'], 'sid', null, $permFilter, null, $args['SQLcache']);
} elseif (isset($timestring)) {
$tables = DBUtil::getTables();
$col = $tables['news_column'];
$where = "{$col['urltitle']} = '".DataUtil::formatForStore($args['title'])."' AND {$col['from']} LIKE '{$timestring}%'";
$item = DBUtil::selectObject('news', $where, null, $permFilter, null, $args['SQLcache']);
} else {
$item = DBUtil::selectObjectByID('news', $args['title'], 'urltitle', null, $permFilter, null, $args['SQLcache']);
}
if (empty($item))
return false;
// Sanity check for the published status if required
if (isset($args['status'])) {
if ($item['published_status'] != $args['status']) {
return false;
}
}
// process the relative paths of the categories
if ($this->getVar('enablecategorization') && !empty($item['__CATEGORIES__'])) {
static $registeredCats;
if (!isset($registeredCats)) {
$registeredCats = CategoryRegistryUtil::getRegisteredModuleCategories('News', 'news');
}
ObjectUtil::postProcessExpandedObjectCategories($item['__CATEGORIES__'], $registeredCats);
if (!CategoryUtil::hasCategoryAccess($item['__CATEGORIES__'], 'News')) {
return false;
}
}
return $item;
}
示例6: nommateria
public function nommateria($args) {
extract($args);
$table = DBUtil::getTables();
$c = &$table['IWbooks_materies_column'];
$where = "$c[codi_mat] = '$codi_mat'";
$item = DBUtil::selectObject('IWbooks_materies', $where);
return $item['codi_mat'];
}
示例7: membersGroupgest
/**
* Gestiona-Informa dels usuaris d'un grup de zikula del catàleg
*
* > Retorna la informació de tots els membres del grup triat.\n
* > Depenent del grup, permetrà la seva edició o només mostrarà la informació.\n
* > Per als grups generals (Catàleg, Excatàleg, Personals, Genèrics) i pel grup Editors obtindrem la informació.\n
* > El grup Gestors només podrà ser editat per el Gestor-Administrador.
*
* ### Paràmetres rebuts per GET:
* * numeric **gid** gid del grup de zikula a gestionar.
*
* @return void Plantilla *Cataleg_admin_membersGroupview.tpl* o *Cataleg_admin_membersGroupgest.tpl*
*/
public function membersGroupgest() {
//Comprovacions de seguretat. Només els gestors poden crear i editar usuaris
if (!SecurityUtil::checkPermission('Cataleg::', '::', ACCESS_ADMIN)) {
return LogUtil::registerPermissionError();
}
$gid = FormUtil::getPassedValue('gid', null, 'GET');
$grup = UserUtil::getGroup($gid);
//Només es poden gestionar els membres dels grups del catàleg
$grupsUnitats = ModUtil::getVar('Cataleg', 'grupsUnitats');
$grupsZikula = ModUtil::getVar('Cataleg', 'grupsZikula');
if (!in_array($gid, $grupsUnitats) && !in_array($gid, $grupsZikula)) {
LogUtil::registerError($this->__('No es poden gestionar els membres del grup indicat.'));
return system::redirect(ModUtil::url('Cataleg', 'admin', 'groupsgest'));
}
$users = UserUtil::getUsers('', 'uname', -1, -1, 'uid');
foreach ($users as $key => $user) {
$users[$key]['iw'] = DBUtil::selectObject('IWusers', 'where iw_uid =' . $key);
}
$catUsersList = UserUtil::getUsersForGroup($grupsZikula['Sirius']);
$groupUsersList = UserUtil::getUsersForGroup($gid);
foreach ($users as $user) {
if (in_array($user['uid'], $catUsersList)) {
if (in_array($user['uid'], $groupUsersList)) {
$usuaris[1][] = $user;
} else {
$usuaris[0][] = $user;
}
} else {
if (in_array($user['uid'], $groupUsersList)) {
$usuaris[2][] = $user;
}
}
}
$this->view->assign('usuaris', $usuaris);
$this->view->assign('grup', $grup);
if ((!SecurityUtil::checkPermission('CatalegAdmin::', '::', ACCESS_ADMIN) && $gid == $grupsZikula['Gestors']) || $gid == $grupsZikula['UNI'] || $gid == $grupsZikula['ST'] || $gid == $grupsZikula['SE'] || $gid == $grupsZikula['Gestform'] || $gid == $grupsZikula['LectorsCat'] || $gid == $grupsZikula['EditorsCat'] || $gid == $grupsZikula['Personals'] || $gid == $grupsZikula['Generics'] || $gid == $grupsZikula['Sirius'] || $gid == $grupsZikula['ExSirius']) {
return $this->view->fetch('admin/Cataleg_admin_membersGroupview.tpl');
} else {
return $this->view->fetch('admin/Cataleg_admin_membersGroupgest.tpl');
}
}
示例8: retrieveObjectMetaData
/**
* Retrieve object meta data.
*
* @param array &$obj The object we wish to retrieve metadata for.
* @param string $tablename The object's tablename.
* @param string $idcolumn The object's idcolumn (optional) (default='id').
*
* @return The object with the meta data filled in
*/
public static function retrieveObjectMetaData(&$obj, $tablename, $idcolumn = 'id')
{
$meta = self::fixObjectMetaData($obj, $tablename, $idcolumn);
if ($meta['obj_id'] > 0) {
$dbtables = DBUtil::getTables();
$meta_column = $dbtables['objectdata_meta_column'];
$where = "WHERE {$meta_column['module']}='" . DataUtil::formatForStore($meta['module']) . "'\n AND {$meta_column['table']}='" . DataUtil::formatForStore($meta['table']) . "'\n AND {$meta_column['idcolumn']}='" . DataUtil::formatForStore($meta['idcolumn']) . "'\n AND {$meta_column['obj_id']}='" . DataUtil::formatForStore($meta['obj_id']) . "'";
return DBUtil::selectObject('objectdata_meta', $where);
}
return true;
}
示例9: getGtafGroups
/**
* Funció per l'obtenció de la informació d'una entitat-gtaf
*
* > Obté un array amb la informació de l'entitat-gtaf
*
* @return array *gtafEntity* amb tota la informació de la entitat
*/
public function getGtafGroups($gtafgid) {
$gtafInfo = array();
if (isset($gtafgid)){
$gtafInfo['group'] = DBUtil::selectObject('cataleg_gtafGroups','gtafGroupId="'.$gtafgid.'"');
}
$gtafInfo['groups'] = DBUtil::selectFieldArray('cataleg_gtafGroups','gtafGroupId');
$grupsZikula = ModUtil::getVar("Cataleg", "grupsZikula");
$usercatlist = UserUtil::getUsersForGroup($grupsZikula['Sirius']);
$users = UserUtil::getUsers('', 'uname', -1, -1, 'uid');
foreach ($users as $key => $user) {
if (in_array($key, $usercatlist)) {
$gtafInfo['catusers'][$key] = array('zk' => $user, 'iw' => DBUtil::selectObject('IWusers', 'where iw_uid =' . $key));
}
}
return $gtafInfo;
}
示例10: detail
public function detail($code)
{
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Llicencies::', '::', ACCESS_READ));
$info = array();
if ($code) {
$where = 'codi_treball='.$code;
$info = DBUtil::selectObject('llicencies', $where);
}
return $info;
}
示例11: getWorkflowForObject
/**
* Load workflow for object.
*
* Will attach array '__WORKFLOW__' to the object.
*
* @param array &$obj Array object.
* @param string $dbTable Database table.
* @param string $idcolumn Id field, default = 'id'.
* @param string $module Module name (defaults to current module).
*
* @return boolean
*/
public static function getWorkflowForObject(&$obj, $dbTable, $idcolumn = 'id', $module = null)
{
if (empty($module)) {
$module = ModUtil::getName();
}
if (!isset($obj) || !is_array($obj) && !is_object($obj)) {
return z_exit(__f('%1$s: %2$s is not an array nor an object.', array('Zikula_Workflow_Util::getWorkflowForObject', 'object')));
}
if (!isset($dbTable)) {
return z_exit(__f('%1$s: %2$s is not specified.', array('Zikula_Workflow_Util::getWorkflowForObject', 'dbTable')));
}
$workflow = false;
if (!empty($obj[$idcolumn])) {
// get workflow data from DB
$dbtables = DBUtil::getTables();
$workflows_column = $dbtables['workflows_column'];
$where = "WHERE {$workflows_column['module']} = '" . DataUtil::formatForStore($module) . "'\n AND {$workflows_column['obj_table']} = '" . DataUtil::formatForStore($dbTable) . "'\n AND {$workflows_column['obj_idcolumn']} = '" . DataUtil::formatForStore($idcolumn) . "'\n AND {$workflows_column['obj_id']} = '" . DataUtil::formatForStore($obj[$idcolumn]) . "'";
$workflow = DBUtil::selectObject('workflows', $where);
}
if (!$workflow) {
$workflow = array('state' => 'initial', 'obj_table' => $dbTable, 'obj_idcolumn' => $idcolumn, 'obj_id' => $obj[$idcolumn]);
}
// attach workflow to object
if ($obj instanceof Doctrine_Record) {
$obj->mapValue('__WORKFLOW__', $workflow);
} else {
$obj['__WORKFLOW__'] = $workflow;
}
return true;
}
示例12: beanaddmessage
/**
* Add a message to the specified section item
* @author Sara Arjona Téllez (sarjona@xtec.cat)
* @param args array with the bean parameters
* @return XML with the result of the callback
*/
public function beanaddmessage($args) {
extract($args);
if (!($assignment = DBUtil::selectObjectByID('IWqv_assignments', $assignmentid, 'qvaid'))) {
$error = "error_assignmentid_does_not_exist";
} else {
$pntable = DBUtil::getTables();
$c = $pntable['IWqv_sections_column'];
$where = " $c[qvaid]=$assignmentid AND $c[sectionid]='$sectionid' ";
if (!$section = DBUtil::selectObject('IWqv_sections', $where)) {
// Insert section
$section = array('qvaid' => $assignmentid,
'sectionid' => $sectionid);
if (!($section = DBUtil::insertObject($section, 'IWqv_sections', 'qvsid'))) {
$error = "error_db_insert";
}
}
if (!isset($error)) {
// Insert message
$message = array('qvsid' => $section[qvsid],
'itemid' => $itemid,
'userid' => $userid,
'message' => $message);
if (!($qvmid = DBUtil::insertObject($message, 'IWqv_messages', 'qvmid'))) {
$error = "error_db_insert";
}
}
}
$response .= "<bean id=\"$beanid\" assignmentid=\"$assignmentid\" sectionid=\"$sectionid\" itemid=\"$itemid\" userid=\"$userid\" >";
$response .= " <message id=\"$qvmid\" ";
if (isset($error))
$response .= " error=\"$error\" ";
$response .= '/>';
$response .= '</bean>';
return $response;
}
示例13: getUserPreEmail
/**
* Retrieve the user's new e-mail address that is awaiting his confirmation.
*
* @return string The e-mail address waiting for confirmation for the current user.
*
* @throws Zikula_Exception_Forbidden Thrown if the current user is logged in.
*/
public function getUserPreEmail()
{
if (!UserUtil::isLoggedIn()) {
throw new Zikula_Exception_Forbidden();
}
$dbinfo = DBUtil::getTables();
$verifychgColumn = $dbinfo['users_verifychg_column'];
// delete all the records from e-mail confirmation that have expired
$chgEmailExpireDays = $this->getVar(Users_Constant::MODVAR_EXPIRE_DAYS_CHANGE_EMAIL, Users_Constant::DEFAULT_EXPIRE_DAYS_CHANGE_EMAIL);
if ($chgEmailExpireDays > 0) {
$staleRecordUTC = new DateTime(null, new DateTimeZone('UTC'));
$staleRecordUTC->modify("-{$chgEmailExpireDays} days");
$staleRecordUTCStr = $staleRecordUTC->format(Users_Constant::DATETIME_FORMAT);
$where = "({$verifychgColumn['created_dt']} < '{$staleRecordUTCStr}') AND ({$verifychgColumn['changetype']} = " . Users_Constant::VERIFYCHGTYPE_EMAIL . ")";
DBUtil::deleteWhere ('users_verifychg', $where);
}
$uid = UserUtil::getVar('uid');
$item = DBUtil::selectObject('users_verifychg',
"({$verifychgColumn['uid']} = {$uid}) AND ({$verifychgColumn['changetype']} = " . Users_Constant::VERIFYCHGTYPE_EMAIL . ")");
if (!$item) {
return false;
}
return $item;
}
示例14: mediashare_invitationapi_getByKey
function mediashare_invitationapi_getByKey($args)
{
$dom = ZLanguage::getModuleDomain('mediashare');
$key = DataUtil::formatForStore($args['key']);
$pntable = pnDBGetTables();
$invitationColumn = $pntable['mediashare_invitation_column'];
$where = " {$invitationColumn['key']} = '{$key}'\n AND ( {$invitationColumn['expires']} > NOW()\n OR {$invitationColumn['expires']} IS NULL)";
$invitation = DBUtil::selectObject('mediashare_invitation', $where);
if ($invitation === false) {
return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('invitationapi.getByKey', 'Could not retrieve the invitation.'), $dom));
}
return $invitation;
}
示例15: getUnitat
/**
* Torna array amb les dades de la unitat sol·licitada
*
* > Torna les valors de la unitat i, si **simple!=true**, a més, dos elements addicionals:
* > **resp** -> array amb les dades de tots els responsables
* > **numresp** -> nombre de responsables que té la unitat
*
* ### Paràmetres rebuts per GET:
* * integer **uniId** Identificador d'unitat
* * boolean **simple**
*
* @return array Informació sobre
*/
public function getUnitat($args) {
//Verificar permisos
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Cataleg::', '::', ACCESS_READ));
$uniId = FormUtil::getPassedValue('uniId', isset($args['uniId']) ? $args['uniId'] : null, 'GET');
$simple = FormUtil::getPassedValue('simple', false, 'GET');
if (isset($uniId) && is_numeric($uniId)) {
$where = 'uniId=' . $uniId;
} else {
$where = null;
}
$registre = DBUtil::selectObject('cataleg_unitats', $where);
if ($registre === false) {
return LogUtil::registerError($this->__('La consulta no ha obtingut cap resultat.'));
}
if (!$simple) {
if (count($registre) > 0) {
$where = " uniId= '" . $registre['uniId'] . "' ";
$respon = DBUtil::selectObjectArray('cataleg_responsables', $where);
if ($respon === false) {
return LogUtil::registerError($this->__('La consulta no ha obtingut cap resultat.'));
}
foreach ($respon as $re) {
$registre['resp'][] = array('responsable' => $re['responsable'],
'email' => $re['email'],
'telefon' => $re['telefon']);
}
$registre['numresp'] = count($respon);
} else {
return LogUtil::registerError($this->__('La consulta no ha obtingut cap resultat.'));
}
}
return $registre;
}