当前位置: 首页>>代码示例>>PHP>>正文


PHP z_exit函数代码示例

本文整理汇总了PHP中z_exit函数的典型用法代码示例。如果您正苦于以下问题:PHP z_exit函数的具体用法?PHP z_exit怎么用?PHP z_exit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了z_exit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 function delete()
 {
     // security check
     if (!SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_ADMIN)) {
         return LogUtil::registerPermissionError();
     }
     $ot = FormUtil::getPassedValue('ot', 'categories', 'GETPOST');
     $id = (int) FormUtil::getPassedValue('id', 0, 'GETPOST');
     $url = ModUtil::url('AddressBook', 'admin', 'view', array('ot' => $ot));
     $class = 'AddressBook_DBObject_' . ucfirst($ot);
     if (!class_exists($class)) {
         return z_exit(__f('Error! Unable to load class [%s]', $ot));
     }
     $object = new $class();
     $data = $object->get($id);
     if (!$data) {
         LogUtil::registerError(__f('%1$s with ID of %2$s doesn\'\\t seem to exist', array($ot, $id)));
         return System::redirect($url);
     }
     $object->delete();
     if ($ot == "customfield") {
         $sql = "ALTER TABLE addressbook_address DROP adr_custom_" . $id;
         try {
             DBUtil::executeSQL($sql, -1, -1, true, true);
         } catch (Exception $e) {
         }
     }
     LogUtil::registerStatus($this->__('Done! Item deleted.'));
     return System::redirect($url);
 }
开发者ID:nmpetkov,项目名称:AddressBook,代码行数:30,代码来源:Admin.php

示例2: smarty_function_selectmodobject

/**
 * render plugin for fetching a particular module object
 *
 * Examples
 *   {selectmodobject module="AutoCustomer" objecttype="customer" id=4 assign="myCustomer"}
 *   {selectmodobject module="AutoCocktails" objecttype="recipe" id=12 assign="myRecipe"}
 *   {selectmodobject recordClass="AutoCocktails_Model_Recipe" id=12 assign="myRecipe"}
 *
 * Parameters:
 *  module      Name of the module storing the desired object (in DBObject mode)
 *  objecttype  Name of object type (in DBObject mode)
 *  recordClass Class name of an doctrine record. (in Doctrine mode)
 *  id          Identifier of desired object
 *  prefix      Optional prefix for class names (defaults to PN) (in DBObject mode)
 *  assign      Name of the returned object
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return void
 */
function smarty_function_selectmodobject($params, Zikula_View $view)
{
    if (isset($params['recordClass']) && !empty($params['recordClass'])) {
        $doctrineMode = true;
    } else {
        // DBObject checks
        if (!isset($params['module']) || empty($params['module'])) {
            $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('selectmodobject', 'module')));
        }
        if (!isset($params['objecttype']) || empty($params['objecttype'])) {
            $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('selectmodobject', 'objecttype')));
        }
        if (!isset($params['prefix'])) {
            $params['prefix'] = 'PN';
        }
        $doctrineMode = false;
    }
    if (!isset($params['id']) || empty($params['id']) || !is_numeric($params['id'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('selectmodobject', 'id')));
    }
    if (!isset($params['assign']) || empty($params['assign'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('selectmodobject', 'assign')));
    }
    // load object depending on mode: doctrine or dbobject
    if (!$doctrineMode) {
        if (!ModUtil::available($params['module'])) {
            $view->trigger_error(__f('Invalid %1$s passed to %2$s.', array('module', 'selectmodobject')));
        }
        ModUtil::dbInfoLoad($params['module']);
        $classname = "{$params['module']}_DBObject_" . StringUtil::camelize($params['objecttype']);
        if (!class_exists($classname) && System::isLegacyMode()) {
            // BC check for PNObject old style.
            // load the object class corresponding to $params['objecttype']
            if (!($class = Loader::loadClassFromModule($params['module'], $params['objecttype'], false, false, $params['prefix']))) {
                z_exit(__f('Unable to load class [%s] for module [%s]', array(DataUtil::formatForDisplay($params['objecttype']), DataUtil::formatForDisplay($params['module']))));
            }
        }
        // intantiate object model
        $object = new $class();
        $idField = $object->getIDField();
        // assign object data
        // this performs a new database select operation
        // while the result will be saved within the object, we assign it to a local variable for convenience
        $objectData = $object->get(intval($params['id']), $idField);
        if (!is_array($objectData) || !isset($objectData[$idField]) || !is_numeric($objectData[$idField])) {
            $view->trigger_error(__('Sorry! No such item found.'));
        }
    } else {
        $objectData = Doctrine_Core::getTable($params['recordClass'])->find($params['id']);
        if ($objectData === false) {
            $view->trigger_error(__('Sorry! No such item found.'));
        }
    }
    $view->assign($params['assign'], $objectData);
}
开发者ID:projectesIF,项目名称:Sirius,代码行数:76,代码来源:function.selectmodobject.php

示例3: setCookie

 /**
  * Set a cookie value.
  *
  * @param string  $name    Name of cookie.
  * @param string  $value   Value.
  * @param integer $expires Unix epoch date for expiry.
  * @param string  $path    Cookie path.
  * @param string  $domain  Domain must be at least .domain.tld.
  * @param boolean $secure  To set if cookie must only be set over existing https connection.
  * @param boolean $signed  Override system setting to use signatures.
  *
  * @return boolean
  */
 public static function setCookie($name, $value = '', $expires = null, $path = null, $domain = null, $secure = null, $signed = true)
 {
     if (!$name) {
         return z_exit(__f("Error! In 'setCookie', you must specify at least the cookie name '%s'.", DataUtil::formatForDisplay($name)));
     }
     if (!is_string($value)) {
         return z_exit('setCookie: ' . DataUtil::formatForDisplay($value) . ' must be a string');
     }
     if (System::getVar('signcookies') && !$signed == false) {
         // sign the cookie
         $value = SecurityUtil::signData($value);
     }
     return setcookie($name, $value, $expires, $path, $domain, $secure);
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:27,代码来源:CookieUtil.php

示例4: prepare

 public function prepare(&$groups)
 {
     if (!self::$filter) {
         $filter = array('__META__' => array('module' => 'TimeIt'));
         $items = $this->getItems($groups);
         // load the categories system
         if (!($class = Loader::loadClass('CategoryRegistryUtil'))) {
             z_exit('Unable to load class [CategoryRegistryUtil] ...');
         }
         $properties = CategoryRegistryUtil::getRegisteredModuleCategories('TimeIt', 'TimeIt_events');
         foreach ($properties as $prop => $catid) {
             $filter[$prop] = $items;
         }
         self::$filter = DBUtil::generateCategoryFilterWhere('TimeIt_events', false, $filter);
     }
 }
开发者ID:planetenkiller,项目名称:TimeIt,代码行数:16,代码来源:notin.php

示例5: parse

 /**
  * parse xml
  *
  * @param string $xmldata    XML data.
  * @param string $schemaName Schema name.
  * @param string $module     Module name.
  *
  * @return mixed Associative array of workflow or false.
  */
 public function parse($xmldata, $schemaName, $module)
 {
     // parse XML
     if (!xml_parse($this->parser, $xmldata, true)) {
         xml_parser_free($this->parser);
         z_exit(__f('Unable to parse XML workflow (line %1$s, %2$s): %3$s', array(xml_get_current_line_number($this->parser), xml_get_current_column_number($this->parser), xml_error_string($this->parser))));
     }
     // close parser
     xml_parser_free($this->parser);
     // check for errors
     if ($this->workflow['state'] == 'error') {
         return LogUtil::registerError($this->workflow['errorMessage']);
     }
     $this->mapWorkflow();
     if (!$this->validate()) {
         return false;
     }
     $this->workflow['workflow']['module'] = $module;
     $this->workflow['workflow']['id'] = $schemaName;
     return $this->workflow;
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:30,代码来源:Parser.php

示例6: checkPermission

 /**
  * Check permissions
  *
  * @param string   $component Component.
  * @param string   $instance  Instance.
  * @param constant $level     Level.
  * @param integer  $user      User Id.
  *
  * @return boolean
  */
 public static function checkPermission($component = null, $instance = null, $level = null, $user = null)
 {
     static $groupperms = array();
     if (!is_numeric($level)) {
         return z_exit(__f('Invalid security level [%1$s] received in %2$s', array($level, 'SecurityUtil::checkPermission')));
     }
     if (!$user) {
         $user = UserUtil::getVar('uid');
     }
     if (!isset($GLOBALS['authinfogathered'][$user]) || (int) $GLOBALS['authinfogathered'][$user] == 0) {
         $groupperms[$user] = self::getAuthInfo($user);
         // First time here - get auth info
         if (count($groupperms[$user]) == 0) {
             return false;
             // No permissions
         }
     }
     $res = self::getSecurityLevel($groupperms[$user], $component, $instance) >= $level;
     return $res;
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:30,代码来源:SecurityUtil.php

示例7: permissionCheck

 /**
  * Check permission of action
  *
  * @param string  $module    Module name.
  * @param string  $schema    Schema name.
  * @param array   $obj       Array object.
  * @param string  $permLevel Permission level.
  * @param integer $actionId  Action Id.
  *
  * @return boolean
  */
 public static function permissionCheck($module, $schema, $obj = array(), $permLevel = 'overview', $actionId = null)
 {
     // translate permission to something meaningful
     $permLevel = self::translatePermission($permLevel);
     // test conversion worked
     if (!$permLevel) {
         return false;
     }
     // get current user
     $currentUser = UserUtil::getVar('uid');
     // no user then assume anon
     if (empty($currentUser)) {
         $currentUser = -1;
     }
     $function = "{$module}_workflow_{$schema}_permissioncheck";
     if (function_exists($function)) {
         // function already exists
         return $function($obj, $permLevel, $currentUser, $actionId);
     }
     // test operation file exists
     $path = self::_findpath("function.{$schema}_permissioncheck.php", $module);
     if (!$path) {
         return z_exit(__f("Permission check file [%s] does not exist.", "function.{$schema}_permissioncheck.php"));
     }
     // load file and test if function exists
     include_once $path;
     if (!function_exists($function)) {
         return z_exit(__f("Permission check function [%s] not defined.", $function));
     }
     // function must be loaded so now we can execute the function
     return $function($obj, $permLevel, $currentUser, $actionId);
 }
开发者ID:planetenkiller,项目名称:core,代码行数:43,代码来源:Util.php

示例8: getParagraphs

 /**
  * Return a nParas paragraphs of random text based on the dictionary.
  *
  * @param intiger $nParas         The number of paragraphs to return to put in the sentence.
  * @param string  $dict           The dictionary to use (a space separated list of words).
  * @param intiger $irndS          The number of sentences in a paragraph (optional) (default=0=randomlyGenerated).
  * @param intiger $irndW          The number of words in a sentence (optional) (default=0=randomlyGenerated).
  * @param boolean $startCustomary Whether or not to start with the customary phrase (optional) (default=false).
  *
  * @return The resulting random date string.
  */
 public static function getParagraphs($nParas, $dict = '', $irndS = 0, $irndW = 0, $startCustomary = false)
 {
     if (!$nParas) {
         return z_exit(__f('Invalid %1$s passed to %2$s.', array('nParas', 'RandomUtil::getParagraphs')));
     }
     if (!$dict) {
         return z_exit(__f('Invalid %1$s passed to %2$s.', array('dictionary', 'RandomUtil::getParagraphs')));
     }
     $dictArray = explode(' ', $dict);
     $txt = '';
     for ($i = 0; $i < $nParas; $i++) {
         if (!$irndS) {
             $rndS = self::getInteger(3, 7);
         } else {
             $rndS = $irndS;
         }
         for ($j = 0; $j < $rndS; $j++) {
             if (!$irndW) {
                 $rndW = self::getInteger(8, 25);
             } else {
                 $rndW = $irndW;
             }
             $txt .= self::getSentence($rndW, $dictArray);
         }
         $txt .= "\n";
     }
     // start with first 5 words
     if ($startCustomary) {
         $pre = '';
         for ($i = 0; $i < 5; $i++) {
             $pre .= $dictArray[$i] . ' ';
         }
         $startLetter = substr($txt, 0, 1);
         $txt = $pre . strtolower($startLetter) . substr($txt, 1);
     }
     return $txt;
 }
开发者ID:planetenkiller,项目名称:core,代码行数:48,代码来源:RandomUtil.php

示例9: getSelector_TableFields

 /**
  * Selector for a module's tables.
  *
  * @param string  $modname           Module name.
  * @param string  $tablename         Table name.
  * @param string  $name              Select field name.
  * @param string  $selectedValue     Selected value.
  * @param string  $defaultValue      Value for "default" option.
  * @param string  $defaultText       Text for "default" option.
  * @param boolean $submit            Submit on choose.
  * @param boolean $showSystemColumns Whether or not to show the system columns.
  * @param boolean $disabled          Add Disabled attribute to select.
  * @param integer $multipleSize      Size for multiple selects.
  *
  * @return string The rendered output.
  */
 public static function getSelector_TableFields($modname, $tablename, $name, $selectedValue = '', $defaultValue = 0, $defaultText = '', $submit = false, $showSystemColumns = false, $disabled = false, $multipleSize = 1)
 {
     if (!$modname) {
         return z_exit(__f('Invalid %1$s passed to %2$s.', array('modname', 'HtmlUtil::getSelector_TableFields')));
     }
     if (!$tablename) {
         return z_exit(__f('Invalid %1$s passed to %2$s.', array('tablename', 'HtmlUtil::getSelector_TableFields')));
     }
     if (!$name) {
         return z_exit(__f('Invalid %1$s passed to %2$s.', array('name', 'HtmlUtil::getSelector_TableFields')));
     }
     $tables = ModUtil::dbInfoLoad($modname, '', true);
     $colkey = $tablename . '_column';
     $cols = $tables[$colkey];
     if (!$cols) {
         return z_exit(__f('Invalid %1$s [%2$s] in %3$s.', array('column key', $colkey, 'HtmlUtil::getSelector_TableFields')));
     }
     if (!$showSystemColumns) {
         $filtercols = array();
         ObjectUtil::addStandardFieldsToTableDefinition($filtercols, '');
     }
     $data = array();
     foreach ($cols as $k => $v) {
         if ($showSystemColumns) {
             $data[$v] = $k;
         } else {
             if (!$filtercols[$k]) {
                 $data[$v] = $k;
             }
         }
     }
     return self::getSelector_Generic($name, $data, $selectedValue, $defaultValue, $defaultText, $allValue, $allText, $submit, $disabled, $multipleSize);
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:49,代码来源:HtmlUtil.php

示例10: postProcessExpandedObjectCategories

 /**
  * Post-process an object's expanded category data to generate relative paths.
  *
  * @param array   &$obj        The object we wish to post-process.
  * @param array   $rootCatsIDs The root category ID for the relative path creation.
  * @param boolean $includeRoot Whether or not to include the root folder in the relative path (optional) (default=false).
  *
  * @return The object with the additionally expanded category data is altered in place and returned
  */
 public static function postProcessExpandedObjectCategories(&$obj, $rootCatsIDs, $includeRoot = false)
 {
     if (!$obj) {
         return z_exit(__f('Invalid object in %s', 'postProcessExpandedObjectCategories'));
     }
     $rootCats = CategoryUtil::getCategoriesByRegistry($rootCatsIDs);
     if (empty($rootCats)) {
         return false;
     }
     // if the function was called to process the object categories
     if (isset($obj['__CATEGORIES__'])) {
         $ak = array_keys($obj['__CATEGORIES__']);
         foreach ($ak as $prop) {
             CategoryUtil::buildRelativePathsForCategory($rootCats[$prop], $obj['__CATEGORIES__'][$prop], $includeRoot);
         }
         // else, if the function was called to process the categories array directly
     } else {
         $ak = array_keys($obj);
         foreach ($ak as $prop) {
             CategoryUtil::buildRelativePathsForCategory($rootCats[$prop], $obj[$prop], $includeRoot);
         }
     }
     return;
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:33,代码来源:ObjectUtil.php

示例11: getLimitedTablename

 /**
  * Limit the table name if necessary and prepend the prefix.
  *
  * When using Oracle the object name may not be longer than 30 chars. Now ADODB uses TRIGGERS and SEQUENCEs to emulate the AUTOINCREMENT
  * which eats up to 9 chars (TRIG_SEQ_<prefix>_<tablename>) so we have to limit the length of the table name to
  * 30 - 9 - length(prefix) - separator.
  * We use this function as a central point to shorten table name (there might be restrictions in ' other RDBMS too). If the resulting tablename is
  * empty we will show an error. In this case the prefix is too long.
  *
  * @param string $table        The treated table reference.
  * @param string $dbDriverName The driver used for this DB (optional).
  *
  * @deprecated
  * @see    Doctrines DBAL layer.
  *
  * @return boolean
  */
 public static function getLimitedTablename($table, $dbDriverName = '')
 {
     if (!$dbDriverName) {
         $dbDriverName = strtolower(Doctrine_Manager::getInstance()->getCurrentConnection()->getDriverName());
     }
     $prefix = self::getTablePrefix($table);
     switch ($dbDriverName) {
         case 'oracle':
             // Oracle
             $maxlen = 30;
             // max length for a tablename
             $_tablename = $table;
             // save for later if we need to show an error
             $lenTable = strlen($table);
             $lenPrefix = strlen($prefix);
             // 10 for length of TRIG_SEQ_ + _
             if ($lenTable + $lenPrefix + 10 > $maxlen) {
                 $table = substr($table, 0, $maxlen - 10 - $lenPrefix);
                 // same as 20-strlen(), but easier to understand :-)
             }
             if (empty($table)) {
                 return z_exit(__f('%1$s: unable to limit tablename [%2$s] because database prefix is too long for Oracle, please shorten it (recommended length is 4 chars)', array(__CLASS__ . '::' . __FUNCTION__, DataUtil::formatForDisplay($_tablename))));
             }
             break;
         default:
             // no action necessary, use tablename as is
             break;
     }
     // finally build the tablename
     $tablename = $prefix ? $prefix . '_' . $table : $table;
     return $tablename;
 }
开发者ID:planetenkiller,项目名称:core,代码行数:49,代码来源:DBUtil.php

示例12: load

 /**
  * Load event handler.
  *
  * @param Zikula_Form_View $view Reference to Zikula_Form_View object.
  * @param array            &$params Parameters passed from the Smarty plugin function.
  *
  * @return void
  */
 public function load(Zikula_Form_View $view, &$params)
 {
     if ($this->showEmptyValue != 0) {
         $this->addItem('- - -', 0);
     }
     // switch between doctrine and dbobject mode
     if ($this->recordClass) {
         $q = Doctrine::getTable($this->recordClass)->createQuery();
         if ($this->where) {
             if (is_array($this->where)) {
                 $q->where($this->where[0], $this->where[1]);
             } else {
                 $q->where($this->where);
             }
         }
         if ($this->orderby) {
             $q->orderBy($this->orderby);
         }
         if ($this->pos >= 0) {
             $q->offset($this->pos);
         }
         if ($this->num > 0) {
             $q->limit($this->num);
         }
         $rows = $q->execute();
         foreach ($rows as $row) {
             $itemLabel = $row[$this->displayField];
             if (!empty($this->displayFieldTwo)) {
                 $itemLabel .= ' (' . $row[$this->displayFieldTwo] . ')';
             }
             $this->addItem($itemLabel, $row[$this->idField]);
         }
     } else {
         ModUtil::dbInfoLoad($this->module);
         // load the object class corresponding to $this->objecttype
         $class = "{$this->module}_DBObject_" . StringUtil::camelize($this->objecttype) . 'Array';
         if (!class_exists($class) && System::isLegacyMode()) {
             if (!($class = Loader::loadArrayClassFromModule($this->module, $this->objecttype, false, $this->prefix))) {
                 z_exit(__f('Unable to load class [%s] for module [%s]', array(DataUtil::formatForDisplay($this->objecttype, $this->module))));
             }
         }
         // instantiate the object-array
         $objectArray = new $class();
         // get() returns the cached object fetched from the DB during object instantiation
         // get() with parameters always performs a new select
         // while the result will be saved in the object, we assign in to a local variable for convenience.
         $objectData = $objectArray->get($this->where, $this->orderby, $this->pos, $this->num);
         foreach ($objectData as $obj) {
             $itemLabel = $obj[$this->displayField];
             if (!empty($this->displayFieldTwo)) {
                 $itemLabel .= ' (' . $obj[$this->displayFieldTwo] . ')';
             }
             $this->addItem($itemLabel, $obj[$this->idField]);
         }
     }
     parent::load($view, $params);
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:65,代码来源:DropdownRelationList.php

示例13: smarty_function_selectmodobjectarray

/**
 * render plugin for fetching a list of module objects
 *
 * Examples
 *   {selectmodobjectarray module="AutoCustomer" objecttype="customer" assign="myCustomers"}
 *   {selectmodobjectarray module="AutoCocktails" objecttype="recipe" orderby="name desc" assign="myRecipes"}
 *   {selectmodobjectarray recordClass="AutoCocktails_Model_Recipe" orderby="name desc" assign="myRecipes"}
 *
 * Parameters:
 *  module      Name of the module storing the desired object (in DBObject mode)
 *  objecttype  Name of object type (in DBObject mode)
 *  recordClass Class name of an doctrine record. (in Doctrine mode)
 *  useArrays   true to fetch arrays and false to fetch objects (default is true) (in Doctrine mode)
 *  where       Filter value
 *  orderby     Sorting field and direction
 *  pos         Start offset
 *  num         Amount of selected objects
 *  prefix      Optional prefix for class names (defaults to PN) (in DBObject mode)
 *  assign      Name of the returned object
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the Zikula_View object.
 *
 * @return void
 */
function smarty_function_selectmodobjectarray($params, Zikula_View $view)
{
    if (isset($params['recordClass']) && !empty($params['recordClass'])) {
        $doctrineMode = true;
    } else {
        // DBObject checks
        if (!isset($params['module']) || empty($params['module'])) {
            $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('selectmodobjectarray', 'module')));
        }
        if (!isset($params['objecttype']) || empty($params['objecttype'])) {
            $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('selectmodobjectarray', 'objecttype')));
        }
        if (!isset($params['prefix'])) {
            $params['prefix'] = 'PN';
        }
        $doctrineMode = false;
    }
    if (!isset($params['assign'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('selectmodobjectarray', 'assign')));
    }
    // load object depending on mode: doctrine or dbobject
    if (!$doctrineMode) {
        if (!ModUtil::available($params['module'])) {
            $view->trigger_error(__f('Invalid %1$s passed to %2$s.', array('module', 'selectmodobjectarray')));
        }
        ModUtil::dbInfoLoad($params['module']);
        $classname = "{$params['module']}_DBObject_" . StringUtil::camelize($params['objecttype']) . 'Array';
        if (!class_exists($classname) && System::isLegacyMode()) {
            // BC check for PNObjectArray old style.
            // load the object class corresponding to $params['objecttype']
            if (!($class = Loader::loadArrayClassFromModule($params['module'], $params['objecttype'], false, $params['prefix']))) {
                z_exit(__f('Error! Cannot load module array class %1$s for module %2$s.', array(DataUtil::formatForDisplay($params['module']), DataUtil::formatForDisplay($params['objecttype']))));
            }
        }
        // instantiate the object-array
        $objectArray = new $class();
        // convenience vars to make code clearer
        $where = $sort = '';
        if (isset($params['where']) && !empty($params['where'])) {
            $where = $params['where'];
        }
        // TODO: add FilterUtil support here in 2.0
        if (isset($params['orderby']) && !empty($params['orderby'])) {
            $sort = $params['orderby'];
        }
        $pos = 1;
        if (isset($params['pos']) && !empty($params['pos']) && is_numeric($params['pos'])) {
            $pos = $params['pos'];
        }
        $num = 10;
        if (isset($params['num']) && !empty($params['num']) && is_numeric($params['num'])) {
            $num = $params['num'];
        }
        // get() returns the cached object fetched from the DB during object instantiation
        // get() with parameters always performs a new select
        // while the result will be saved in the object, we assign in to a local variable for convenience.
        $objectData = $objectArray->get($where, $sort, $pos - 1, $num);
    } else {
        $query = Doctrine_Core::getTable($params['recordClass'])->createQuery();
        if (isset($params['where']) && !empty($params['where'])) {
            if (is_array($params['where'])) {
                $query->where($params['where'][0], $params['where'][1]);
            } else {
                $query->where($params['where']);
            }
        }
        if (isset($params['orderby']) && !empty($params['orderby'])) {
            $query->orderBy($params['orderby']);
        }
        $pos = 0;
        if (isset($params['pos']) && !empty($params['pos']) && is_numeric($params['pos'])) {
            $pos = $params['pos'];
        }
        $num = 10;
        if (isset($params['num']) && !empty($params['num']) && is_numeric($params['num'])) {
//.........这里部分代码省略.........
开发者ID:planetenkiller,项目名称:core,代码行数:101,代码来源:function.selectmodobjectarray.php

示例14: _init

 /**
  * Internal intialization routine.
  *
  * If $_init is an arrary it is set(), otherwise it is interpreted as a string specifying
  * the source from where the data should be retrieved from.
  *
  * @param mixed  $init  Initialization value (can be an object or a string directive).
  * @param string $key   The DB key to use to retrieve the object (optional) (default=null).
  * @param strubg $field The field containing the key value (optional) (default=null).
  *
  * @return void
  */
 public function _init($init = null, $key = null, $field = null)
 {
     if ($this->_objType != 'DBOBJECT') {
         $dbtables = DBUtil::getTables();
         $tkey = $this->_objType;
         $ckey = $this->_objType . "_column";
         $this->_table = isset($dbtables[$tkey]) ? $dbtables[$tkey] : null;
         $this->_columns = isset($dbtables[$ckey]) ? $dbtables[$ckey] : null;
         if ($field) {
             $this->_objField = $field;
         } else {
             $this->_objField = 'id';
         }
     }
     if (!$init) {
         return;
     }
     if (is_array($init)) {
         $this->setData($init);
     } elseif (is_string($init)) {
         switch ($init) {
             case self::GET_FROM_DB:
                 if (!$key) {
                     return z_exit("Invalid DB-key in DBObject::_init() ...");
                 }
                 $this->get($key, $field);
                 break;
             case self::GET_FROM_GET:
             case self::GET_FROM_POST:
             case self::GET_FROM_REQUEST:
                 $this->setData($this->getDataFromInput($this->_objPath, null, $init));
                 break;
             case self::GET_FROM_SESSION:
                 $this->getDataFromSource($_SESSION, $this->_objPath);
                 break;
             case self::GET_FROM_VALIDATION_FAILED:
                 $this->getDataFromSource($_SESSION['validationFailedObjects'], $this->_objPath);
                 break;
             default:
                 return z_exit(__f("Error! An invalid initialization directive '%s' found in 'DBObject::_init()'.", $init));
         }
     } else {
         return z_exit(__f("Error! An unexpected parameter type initialization '%s' was encountered in 'DBObject::_init()'.", $init));
     }
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:57,代码来源:DBObject.php

示例15: hasValidationErrors

 /**
  * Return a boolean indicating whether or not the specified field failed validation.
  *
  * @param string $objectType The (string) object type.
  * @param string $field      The fieldname.
  *
  * @return boolean A boolean indicating whether or not the specified field failed validation.
  */
 public static function hasValidationErrors($objectType, $field = null)
 {
     if (!$objectType) {
         return z_exit(__f('Empty %1$s passed to %2$s.', array('objectType', 'FormUtil::hasValidationErrors')));
     }
     if (!$field) {
         return z_exit(__f('Empty %1$s passed to %2$s.', array('field', 'FormUtil::hasValidationErrors')));
     }
     $ve = self::getValidationErrors();
     if (isset($ve[$objectType][$field])) {
         return (bool) $ve[$objectType][$field];
     } else {
         return false;
     }
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:23,代码来源:FormUtil.php


注:本文中的z_exit函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。