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


PHP Application_Model_User::getUsersOfType方法代码示例

本文整理汇总了PHP中Application_Model_User::getUsersOfType方法的典型用法代码示例。如果您正苦于以下问题:PHP Application_Model_User::getUsersOfType方法的具体用法?PHP Application_Model_User::getUsersOfType怎么用?PHP Application_Model_User::getUsersOfType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Application_Model_User的用法示例。


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

示例1: setDbColMetadata

 /**
  * Set multiple metadata values using database columns as indexes.
  *
  * @param array $p_md
  *  example: $p_md['url'] = 'http://www.fake.com'
  */
 public function setDbColMetadata($p_md = null)
 {
     if (is_null($p_md)) {
         foreach ($this->_dbMD as $dbColumn => $propelColumn) {
             $method = "set{$propelColumn}";
             $this->_file->{$method}(null);
         }
     } else {
         $owner = $this->_file->getFkOwner();
         // if owner_id is already set we don't want to set it again.
         if (!$owner) {
             // no owner detected, we try to assign one.
             // if MDATA_OWNER_ID is not set then we default to the
             // first admin user we find
             if (!array_key_exists('owner_id', $p_md)) {
                 //$admins = Application_Model_User::getUsers(array('A'));
                 $admins = Application_Model_User::getUsersOfType('A');
                 if (count($admins) > 0) {
                     // found admin => pick first one
                     $owner = $admins[0];
                 }
             } else {
                 $user = CcSubjsQuery::create()->findPk($p_md['owner_id']);
                 if ($user) {
                     $owner = $user;
                 }
             }
             if ($owner) {
                 $this->_file->setDbOwnerId($owner->getDbId());
             } else {
                 Logging::info("Could not find suitable owner for file\n                        '" . $p_md['MDATA_KEY_FILEPATH'] . "'");
             }
         }
         # We don't want to process owner_id in bulk because we already
         # processed it in the code above. This is done because owner_id
         # needs special handling
         if (array_key_exists('owner_id', $p_md)) {
             unset($p_md['owner_id']);
         }
         foreach ($p_md as $dbColumn => $mdValue) {
             // don't blank out name, defaults to original filename on first
             // insertion to database.
             if ($dbColumn == "track_title" && (is_null($mdValue) || $mdValue == "")) {
                 continue;
             }
             # TODO : refactor string evals
             if (isset($this->_dbMD[$dbColumn])) {
                 $propelColumn = $this->_dbMD[$dbColumn];
                 $method = "set{$propelColumn}";
                 /* We need to set track_number to null if it is an empty string
                  * because propel defaults empty strings to zeros */
                 if ($dbColumn == "track_number" && empty($mdValue)) {
                     $mdValue = null;
                 }
                 $this->_file->{$method}($mdValue);
             }
         }
     }
     $this->_file->setDbMtime(new DateTime("now", new DateTimeZone("UTC")));
     $this->_file->save();
 }
开发者ID:nidzix,项目名称:Airtime,代码行数:67,代码来源:StoredFile.php

示例2: getFirstAdmin

 public static function getFirstAdmin()
 {
     $admins = Application_Model_User::getUsersOfType('A');
     if (count($admins) > 0) {
         // found admin => pick first one
         return $admins[0];
     } else {
         Logging::warn("Warning. no admins found in database");
         return null;
     }
 }
开发者ID:RadioCampusFrance,项目名称:airtime,代码行数:11,代码来源:User.php


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