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


PHP DBUtil::marshallObjects方法代码示例

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


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

示例1: mediashare_mediahandlerapi_getHandlerInfo

function mediashare_mediahandlerapi_getHandlerInfo($args)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    $mimeType = strtolower($args['mimeType']);
    $filename = strtolower($args['filename']);
    if (!empty($filename)) {
        $dotPos = strpos($filename, '.');
        if ($dotPos === false) {
            $fileType = '';
        } else {
            $fileType = substr($filename, $dotPos + 1);
        }
    } else {
        $fileType = '';
    }
    $pntable = pnDBGetTables();
    $handlersTable = $pntable['mediashare_mediahandlers'];
    $handlersColumn = $pntable['mediashare_mediahandlers_column'];
    $sql = "SELECT DISTINCT {$handlersColumn['handler']},\r\n                            {$handlersColumn['foundMimeType']},\r\n                            {$handlersColumn['foundFileType']}\r\n                       FROM {$handlersTable}\r\n                      WHERE {$handlersColumn['mimeType']} = '" . DataUtil::formatForStore($mimeType) . "'\r\n                         OR {$handlersColumn['fileType']} = '" . DataUtil::formatForStore($fileType) . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\tAND {$handlersColumn['active']} =\t1 ";
    $result = DBUtil::executeSQL($sql);
    $errormsg = __f('Unable to locate media handler for \'%1$s\' (%2$s)', array($filename, $mimeType), $dom);
    if ($result === false) {
        return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('mediahandlerapi.getHandlerInfo', $errormsg), $dom));
    }
    if (!$result) {
        return LogUtil::registerError($errormsg);
    }
    $colArray = array('handlerName', 'mimeType', 'fileType');
    $handler = DBUtil::marshallObjects($result, $colArray);
    return $handler[0];
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:31,代码来源:pnmediahandlerapi.php

示例2: search

 /**
  * Performs the actual search processing.
  */
 public function search($args)
 {
     ModUtil::dbInfoLoad('Search');
     $dbtables = DBUtil::getTables();
     $pageTable = $dbtables['content_page'];
     $pageColumn = $dbtables['content_page_column'];
     $contentTable = $dbtables['content_content'];
     $contentColumn = $dbtables['content_content_column'];
     $contentSearchTable = $dbtables['content_searchable'];
     $contentSearchColumn = $dbtables['content_searchable_column'];
     $translatedPageTable = $dbtables['content_translatedpage'];
     $translatedPageColumn = $dbtables['content_translatedpage_column'];
     $sessionId = session_id();
     // check whether we need to search also in translated content
     $multilingual = System::getVar('multilingual');
     $currentLanguage = ZLanguage::getLanguageCode();
     $searchWhereClauses = array();
     $searchWhereClauses[] = '(' . Search_Api_User::construct_where($args, array($pageColumn['title']), $pageColumn['language']) . ')';
     if ($multilingual) {
         $searchWhereClauses[] = '(' . Search_Api_User::construct_where($args, array($translatedPageColumn['title']), $translatedPageColumn['language']) . ')';
     }
     $searchWhereClauses[] = '(' . Search_Api_User::construct_where($args, array($contentSearchColumn['text']), $contentSearchColumn['language']) . ')';
     // add default filters
     $whereClauses = array();
     $whereClauses[] = '(' . implode(' OR ', $searchWhereClauses) . ')';
     $whereClauses[] = $pageColumn['active'] . ' = 1';
     $whereClauses[] = "({$pageColumn['activeFrom']} IS NULL OR {$pageColumn['activeFrom']} <= NOW())";
     $whereClauses[] = "({$pageColumn['activeTo']} IS NULL OR {$pageColumn['activeTo']} >= NOW())";
     $whereClauses[] = $contentColumn['active'] . ' = 1';
     $whereClauses[] = $contentColumn['visiblefor'] . (UserUtil::isLoggedIn() ? ' <= 1' : ' >= 1');
     $titleFields = $pageColumn['title'];
     $additionalJoins = '';
     if ($multilingual) {
         // if searching in non-default languages, we need the translated title
         $titleFields .= ', ' . $translatedPageColumn['title'] . ' AS translatedTitle';
         // join also the translation table if required
         $additionalJoins = "LEFT OUTER JOIN {$translatedPageTable} ON {$translatedPageColumn['pageId']} = {$pageColumn['id']} AND {$translatedPageColumn['language']} = '{$currentLanguage}'";
         // prevent content snippets in other languages
         $whereClauses[] = $contentSearchColumn['language'] . ' = \'' . $currentLanguage . '\'';
     }
     $where = implode(' AND ', $whereClauses);
     $sql = "\n            SELECT DISTINCT {$titleFields},\n            {$contentSearchColumn['text']} AS description,\n            {$pageColumn['id']} AS pageId,\n            {$pageColumn['cr_date']} AS createdDate\n            FROM {$pageTable}\n            JOIN {$contentTable}\n            ON {$contentColumn['pageId']} = {$pageColumn['id']}\n            JOIN {$contentSearchTable}\n            ON {$contentSearchColumn['contentId']} = {$contentColumn['id']}\n            {$additionalJoins}\n            WHERE {$where}\n        ";
     $result = DBUtil::executeSQL($sql);
     if (!$result) {
         return LogUtil::registerError($this->__('Error! Could not load items.'));
     }
     $objectArray = DBUtil::marshallObjects($result);
     foreach ($objectArray as $object) {
         $pageTitle = $object['page_title'];
         if ($object['translatedTitle'] != '') {
             $pageTitle = $object['translatedTitle'];
         }
         $searchItemData = array('title' => $pageTitle, 'text' => $object['description'], 'extra' => $object['pageId'], 'created' => $object['createdDate'], 'module' => 'Content', 'session' => $sessionId);
         if (!\DBUtil::insertObject($searchItemData, 'search_result')) {
             return \LogUtil::registerError($this->__('Error! Could not save the search results.'));
         }
     }
     return true;
 }
开发者ID:robbrandt,项目名称:Content,代码行数:62,代码来源:Search.php

示例3: getContent

 public function getContent()
 {
     ModUtil::dbInfoLoad('Content');
     $dbtables = DBUtil::getTables();
     $query = "SELECT " . $dbtables['content_page_column']['id'] . " , " . $dbtables['content_page_column']['title'] . ", " . $dbtables['content_page_column']['views'] . " \n    \tFROM " . $dbtables['content_page'] . "\n\tWHERE " . $dbtables['content_page_column']['views'] . " >= 0 AND " . $dbtables['content_page_column']['active'] . " >= 0 ORDER BY " . $dbtables['content_page_column']['views'] . " DESC LIMIT 25";
     $dbresult = DBUtil::executeSQL($query);
     $views = DBUtil::marshallObjects($dbresult);
     $view = Zikula_View::getInstance('Content');
     $view->assign('views', $views);
     return $view->fetch('content_widget_top25.tpl');
 }
开发者ID:robbrandt,项目名称:Dashboard,代码行数:11,代码来源:Top25.php

示例4: addCustomFieldsToTableDefinition

function addCustomFieldsToTableDefinition(&$columns)
{
    // get the global db prefix
    $prefix = System::getVar('prefix');
    $prefix = $prefix ? $prefix . '_' : '';
    $tablecustomfields = $prefix . "addressbook_customfields";
    $connection = Doctrine_Manager::getInstance()->getCurrentConnection();
    if ($connection->import->tableExists($tablecustomfields)) {
        $sql = "SELECT cus_id FROM " . $tablecustomfields . " WHERE cus_id > 4 ORDER BY cus_id ASC";
        $result = DBUtil::executeSQL($sql, -1, -1, false, true);
        if ($result) {
            $customfields = DBUtil::marshallObjects($result, array('id'), true);
            foreach ($customfields as $cus) {
                $col_def = 'custom_' . $cus['id'];
                $columns[$col_def] = 'adr_' . $col_def;
            }
        }
    }
    return;
}
开发者ID:nmpetkov,项目名称:AddressBook,代码行数:20,代码来源:tables.php

示例5: createRecords

 protected function createRecords($pid = -1, $lvl = 0)
 {
     $sql = "SELECT * FROM " . $this->tablePrefix . "_ce_contentitems WHERE mc_parent_id={$pid} ORDER BY mc_id";
     $pid = $pid == -1 ? 0 : $pid;
     $this->recordLevels[$pid] = $lvl;
     $result = DBUtil::executeSQL($sql);
     $pages = DBUtil::marshallObjects($result);
     $fieldmap = $this->getFieldMap();
     $i = 0;
     foreach ($pages as $page) {
         // correct values to Content appropriate types
         $page['mc_parent_id'] = $page['mc_parent_id'] == -1 ? 0 : $page['mc_parent_id'];
         $page['mc_status'] = $page['mc_status'] - 1;
         // remap fieldnames
         $currentRecordCount = $this->recordCount;
         foreach ($fieldmap as $newfield => $oldfield) {
             $this->records[$currentRecordCount][$newfield] = $page[$oldfield];
         }
         $this->records[$currentRecordCount]['language'] = ZLanguage::getLanguageCode();
         $this->records[$currentRecordCount]['layouttype'] = 'Column1';
         $this->records[$currentRecordCount]['position'] = $i;
         $this->records[$currentRecordCount]['level'] = $this->recordLevels[$page['mc_parent_id']];
         $this->records[$currentRecordCount]['setleft'] = ++$this->structureIndex;
         //0; //++$left;
         // create contenttype items
         $this->records[$currentRecordCount]['useheader'] = true;
         // this could loop and create multiple contentitems if needed
         $this->records[$currentRecordCount]['contentitems'] = array(0 => array('contenttype' => 'Html', 'areaIndex' => '1', 'inputType' => 'text', 'data' => $page['mc_text']));
         $this->recordCount++;
         $i++;
         // position index
         // create recursive records for all child pages
         $this->createRecords($page['mc_id'], $lvl + 1);
         $this->records[$currentRecordCount]['setright'] = ++$this->structureIndex;
         //1; //++$left;
     }
     //return count($pages);
 }
开发者ID:robbrandt,项目名称:Content,代码行数:38,代码来源:ContentExpress.php

示例6: getContent

 public function getContent()
 {
     $dbtables = DBUtil::getTables();
     $query = "SELECT " . $dbtables['users_column']['user_regdate'] . " , DATE_FORMAT( " . $dbtables['users_column']['user_regdate'] . ", '%Y-%m-%d' ) AS dateval, COUNT( DATE_FORMAT( " . $dbtables['users_column']['user_regdate'] . ", '%Y-%m-%d' ) ) AS datetotal \n    \tFROM " . $dbtables['users'] . "\n\tWHERE " . $dbtables['users_column']['user_regdate'] . " >= ( CURDATE( ) - INTERVAL 1 MONTH ) GROUP BY dateval";
     $dbresult = DBUtil::executeSQL($query);
     $results = DBUtil::marshallObjects($dbresult);
     foreach ($results as $key => $result) {
         $registrations[$result['dateval']] = $result['datetotal'];
     }
     $date = new DateTime();
     $date->sub(new DateInterval('P30D'));
     for ($i = 0; $i < 30; $i++) {
         $date->add(new DateInterval('P1D'));
         if (isset($registrations[$date->format('Y-m-d')])) {
             $days[$date->format('Y-m-d')] = $registrations[$date->format('Y-m-d')];
         } else {
             $days[$date->format('Y-m-d')] = 0;
         }
     }
     $view = Zikula_View::getInstance('Users');
     $view->assign('days', $days);
     return $view->fetch('users_widget_month.tpl');
     return $content;
 }
开发者ID:robbrandt,项目名称:Dashboard,代码行数:24,代码来源:Month.php

示例7: getallbymodule

    /**
     * Get all comments attached to a module
     *
     * @author Mark West
     * @return mixed array of items if successful, false otherwise
     */
    public function getallbymodule($args = array())
    {
        // Security check
        if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_OVERVIEW)) {
            return false;
        }

        // check for a valid module
        if (!isset($args['mod']) || !is_string($args['mod'])) {
            return false;
        }
        $mod = DataUtil::formatForOS($args['mod']);

        // Get database setup
        $tables  = DBUtil::getTables();
        $eztable = $tables['EZComments'];
        $columns = $tables['EZComments_column'];

        $sql = "  SELECT $columns[objectid],
                         $columns[url],
                         count(*)
                    FROM $eztable
                   WHERE $columns[modname] = '$mod'
                GROUP BY $columns[objectid]
                ORDER BY $columns[objectid]";

        $result = DBUtil::executeSQL($sql);

        // Check for an error with the database code, and if so set an appropriate
        // error message and return
        if ($result == false) {
            return LogUtil::registerError($this->__('Error! Could not load items.'));
        }

        // Put items into result array.  Note that each item is checked
        // individually to ensure that the user is allowed access to it before it
        // is added to the results array
        $items = DBUtil::marshallObjects($result, array('objectid', 'url', 'count'));

        // Return the items
        return $items;

    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:49,代码来源:User.php

示例8: getPrimaryKey

 public function getPrimaryKey($tableName)
 {
     $sql = "show index from " .$tableName." where Key_name = 'PRIMARY'";
     $def =DBUtil::marshallObjects(DBUtil::executeSQL($sql));
     return $def[0]['Column_name'];         
 }
开发者ID:projectesIF,项目名称:Sirius,代码行数:6,代码来源:Admin.php

示例9: getTranslations

 public function getTranslations($args)
 {
     $pageId = (int) $args['pageId'];
     $table = DBUtil::getTables();
     $translatedTable = $table['content_translatedcontent'];
     $translatedColumn = $table['content_translatedcontent_column'];
     $contentTable = $table['content_content'];
     $contentColumn = $table['content_content_column'];
     $cols = DBUtil::_getAllColumns('content_translatedcontent');
     $ca = DBUtil::getColumnsArray('content_translatedcontent');
     $sql = "\n            SELECT {$cols}\n            FROM {$translatedTable} t\n            LEFT JOIN {$contentTable} c\n            ON c.{$contentColumn['id']} = t.{$translatedColumn['contentId']}\n            WHERE c.{$contentColumn['pageId']} = {$pageId}";
     $dbresult = DBUtil::executeSQL($sql);
     $translations = DBUtil::marshallObjects($dbresult, $ca);
     return $translations;
 }
开发者ID:robbrandt,项目名称:Content,代码行数:15,代码来源:Content.php

示例10: parametresCerca

    /**
     * Retorna un array que conté els diferents arrays necessaris per als selects del formulari de cerca general
     *
     * > L'array obtingut conté diversos subarrays que retornen la informació  per a selects de:\n
     * > destinataris, modalitats de curs, presencialitat, zones 
     *  
     * @param array $args Array amb els paràmetres de la funció
     *
     * ### Paràmetres de l'array $args:
     * integer **catId** Identificador de catàleg
     * 
     * @return array Subarrays amb selects de tria per a la cerca general
     */
    public function parametresCerca($catId) {
        if (!SecurityUtil::checkPermission('Cataleg::', '::', ACCESS_READ)) {
            return LogUtil::registerPermissionError();
        }

        // recuperem destinataris...       
        //    $destinataris[0] = '';
        $destinatarisTot = ModUtil::apiFunc('Cataleg', 'user', 'getTipus', array('tipus' => 'dest'));
        foreach ($destinatarisTot as $dest) {
            $sql = "SELECT COUNT(*) AS comptat FROM cataleg_activitats WHERE cataleg_activitats.destinataris LIKE CONCAT('%\"','" . $dest['auxId'] . "','\"%')  AND (cataleg_activitats.estat = 3 OR cataleg_activitats.estat =4)AND cataleg_activitats.priId IN (SELECT priId FROM cataleg_prioritats WHERE cataleg_prioritats.eixId IN (SELECT eixId FROM cataleg_eixos WHERE cataleg_eixos.catId = $catId))";
            $result = DBUtil::executeSQL($sql);
            $recordset = DBUtil::marshallObjects($result);
            $count = $recordset[0]['comptat'];
            if ($count > 0) {
                $cerca['pdestinataris'][$dest['auxId']] = $dest['nom'];
            }
        }
        // recuperem modalitats de curs...       
        $cerca['pmodscurs'][0] = '';
        $modscursTot = ModUtil::apiFunc('Cataleg', 'user', 'getTipus', array('tipus' => 'curs'));
        foreach ($modscursTot as $mod) {
            $sql = "SELECT COUNT(*) AS comptat FROM cataleg_activitats WHERE cataleg_activitats.curs =" . $mod['auxId'] . " AND (cataleg_activitats.estat = 3 OR cataleg_activitats.estat =4)AND cataleg_activitats.priId IN (SELECT priId FROM cataleg_prioritats WHERE cataleg_prioritats.eixId IN (SELECT eixId FROM cataleg_eixos WHERE cataleg_eixos.catId = $catId))";
            $result = DBUtil::executeSQL($sql);
            $recordset = DBUtil::marshallObjects($result);
            $count = $recordset[0]['comptat'];
            if ($count > 0) {
                $cerca['pmodscurs'][$mod['auxId']] = $mod['nom'];
            }
        }
        // recuperem presencialitat...       
        $cerca['ppresencials'][0] = '';
        $presenTot = ModUtil::apiFunc('Cataleg', 'user', 'getTipus', array('tipus' => 'pres'));
        foreach ($presenTot as $pres) {
            $sql = "SELECT COUNT(*) AS comptat FROM cataleg_activitats WHERE cataleg_activitats.presencialitat = " . $pres['auxId'] . " AND (cataleg_activitats.estat = 3 OR cataleg_activitats.estat =4)AND cataleg_activitats.priId IN (SELECT priId FROM cataleg_prioritats WHERE cataleg_prioritats.eixId IN (SELECT eixId FROM cataleg_eixos WHERE cataleg_eixos.catId = $catId))";
            $result = DBUtil::executeSQL($sql);
            $recordset = DBUtil::marshallObjects($result);
            $count = $recordset[0]['comptat'];
            if ($count > 0) {
                $cerca['ppresencials'][$pres['auxId']] = $pres['nom'];
            }
        }
        // recuperem zones o lloc...       
        $cerca['psstt'][0] = '';
        $ssttTot = ModUtil::apiFunc('Cataleg', 'user', 'getTipus', array('tipus' => 'sstt'));
        foreach ($ssttTot as $st) {
            $sql = "SELECT COUNT(*) AS comptat FROM cataleg_activitatsZona INNER JOIN cataleg_activitats ON cataleg_activitatsZona.actId=cataleg_activitats.actId  WHERE cataleg_activitatsZona.lloc = " . $st['auxId'] . " AND cataleg_activitatsZona.qtty >0 AND (cataleg_activitats.estat = 3 OR cataleg_activitats.estat =4)AND cataleg_activitats.priId IN (SELECT priId FROM cataleg_prioritats WHERE cataleg_prioritats.eixId IN (SELECT eixId FROM cataleg_eixos WHERE cataleg_eixos.catId = $catId))";
            $result = DBUtil::executeSQL($sql);
            $recordset = DBUtil::marshallObjects($result);
            $count = $recordset[0]['comptat'];
            if ($count > 0) {
                $cerca['psstt'][$st['auxId']] = $st['nom'];
            }
        }
        return $cerca;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:68,代码来源:User.php

示例11: MostCommentsBlock_getall

 public function MostCommentsBlock_getall($args = array())
 {
     if (!isset($args['numitems']) || !is_numeric($args['numitems'])) {
         $args['numitems'] = -1;
     }
     // Security check
     if (!SecurityUtil::checkPermission('EZComments::', '::', ACCESS_OVERVIEW)) {
         return array();
     }
     // Get database setup
     $pntable = pnDBGetTables();
     $table = $pntable['EZComments'];
     $columns =& $pntable['EZComments_column'];
     // form where clause
     $whereclause = array();
     if (isset($args['mod'])) {
         $whereclause[] = "{$columns['modname']} = '" . DataUtil::formatForStore($args['mod']) . "'";
     }
     // create where clause
     $where = '';
     if (!empty($whereclause)) {
         $where = implode(' AND ', $whereclause) . ' and ';
     }
     $permFilter[] = array('component_left' => 'EZComments', 'component_middle' => '', 'component_right' => '', 'instance_left' => 'modname', 'instance_middle' => 'objectid', 'instance_right' => 'id', 'level' => ACCESS_READ);
     $cols = DBUtil::_getAllColumns('EZComments');
     // FIXME: don't need all
     $ca = DBUtil::getColumnsArray('EZComments');
     $ca[] = "count";
     $sql = "\n    SELECT DISTINCT\n           {$cols},\n           count(*) as count\n    FROM {$table}\n    where {$where} {$columns['status']} = 0\n    group by {$columns['modname']},{$columns['objectid']}\n    order by count desc\n    ";
     $dbresult = DBUtil::executeSQL($sql, 0, $args['numitems']);
     $items = DBUtil::marshallObjects($dbresult, $ca);
     // backwards compatibilty: modname -> mod
     foreach (array_keys($items) as $k) {
         $items[$k]['mod'] = $items[$k]['modname'];
     }
     // return the items
     return $items;
 }
开发者ID:rmaiwald,项目名称:EZComments,代码行数:38,代码来源:MostComments.php

示例12: getAllUnreadedMessages

    /**
     * Get all unreaded messages for all forums and all subscribers
     * @author Josep Ferràndiz Farré (jferran6@xtec.cat)
     * 
     * @param $dateTimeFrom timestamp date/time indicates starting period until now to retrieve unreaded messages 
     * @return array with messages unreaded per user, grouped by forum and topic 
     * 
     * @version 3.1.0 
     * @date 09/03/2015
     */
    public function getAllUnreadedMessages($time) {
        $dateTimeFrom = $time['dateTimeFrom'];
        $dateTimeTo   = $time['dateTimeTo'];
        $messages = array();
        $report   = array();
        
        if (!is_null($dateTimeFrom)) {
            $pntable = DBUtil::getTables();
            $f = $pntable['IWforums_definition_column'];
            $t = $pntable['IWforums_temes_column'];
            $m = $pntable['IWforums_msg_column'];
            
            // Get all the messages posted after $dateTimeFrom in subscribibles forums
            $sql  = "SELECT F.$f[fid] AS fid,  M.$m[ftid] AS ftid, M.$m[fmid] AS fmid, M.$m[titol] AS msgTitle, M.$m[usuari] AS user, M.$m[data] AS date, M.$m[llegit] AS readers, T.$t[titol] AS topic, T.$t[order], ";
            $sql .= "F.$f[nom_forum] AS forum, F.subscriptionMode, F.subscribers, F.noSubscribers, F.$f[grup] AS grup, F.$f[mod] AS moderators ";
            $sql .= "FROM `IWforums_msg` AS M, `IWforums_temes` AS T, `IWforums_definition` AS F ";        
            $sql .= "WHERE M.$m[ftid] = T.$t[ftid] AND T.$t[fid] = F.$f[fid] AND F.$f[actiu] = 1 AND M.$m[data] >= ".$dateTimeFrom." AND M.$m[data] < ".$dateTimeTo." AND F.subscriptionMode > 0 ";
            $sql .= "ORDER BY F.$f[fid], T.$t[order], M.$m[data]";
            $query = DBUtil::executeSQL($sql);
            $messages = DBUtil::marshallObjects($query);

            foreach ($messages as $key => $message) {
                // Extract forum moderators
                $moderators = explode('$$', substr($message['moderators'], 0, strlen($message['moderators']) -1));
                unset($moderators[0]);
                //Extract message readers
                $readers = explode('$$', substr($message['readers'], 0, strlen($message['readers']) -1));
                unset($readers[0]);
                // Extract grups 
                $auxGroups = explode('$$', substr($message['grup'], 0, strlen($message['grup']) -1));
                unset($auxGroups[0]);
                $groups = array();
                foreach ($auxGroups as $ag){
                    $g = explode ('|', $ag);
                    $groups[] = $g[0];
                }
                // Construct a unique list with the users that have read access to a forum 
                $members = array();
                foreach ($groups as $group){
                    // Get group members
                    $users = UserUtil::getUsersForGroup($group);
                    foreach ($users as $user){
                        // Avoid duplicated users
                        if (!in_array($user, $members)) $members[$user] = $user;
                    }
                }
                // Add moderators
                foreach ($moderators as $moderator){
                    if (!in_array($moderator, $members)) $members[$moderator] = $moderator;
                }
                // Remove readers
                foreach ($readers as $reader) {
                    if (in_array($reader, $members)) unset($members[$reader]);                        
                }
                
                switch ($message['subscriptionMode']){
                    case IWforums_Constant::COMPULSORY:
                        // Everybody in readers groups are subscribed. Moderator too
                        // Get forum groups                                                
                        $messages[$key]['receivers'] = $members;
                        break;
                    case IWforums_Constant::VOLUNTARY:
                        // Only subscribers group membership
                        $subscribers = explode('$', $message['subscribers']);
                        foreach ($subscribers as $subscriber){
                            if (in_array($subscriber, $members))  $messages[$key]['receivers'][$subscriber] = $subscriber;
                        }
                        break;
                    
                    case IWforums_Constant::OPTIONAL:
                        // Everybody in readers groups execept unsubscribers
                        $noSubscribers = explode('$', $message['noSubscribers']);
                        foreach ($noSubscribers as $noSubscriber){
                            if (in_array($noSubscriber, $members)) unset($member[$noSubscriber]);
                        }
                        $messages[$key]['receivers'] = $members;
                        break;    
                }
            }    
            
            // At this point, every message has a list of receivers
            // Let's construct an array with the associated information to send
            $information = array();
            foreach ($messages as $message){
                if (isset($message['receivers'])) {
                    foreach($message['receivers'] as $receiver){
                        $sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
                        $information[$receiver][$message['fid']]['nom_forum'] = $message['forum'];
                        $information[$receiver][$message['fid']]['subscriptionMode'] = $message['subscriptionMode'];
                        $information[$receiver][$message['fid']]['fid'] = $message['fid'];
//.........这里部分代码省略.........
开发者ID:projectesIF,项目名称:Sirius,代码行数:101,代码来源:User.php

示例13: exportToCsv

    public function exportToCsv($args){
        $optFields = $args['optFields'];        
        $d = date('_Ymd_Hi') ;
        $filename  = $args['filename'];//="")?$args['filename']:"exportUsers" .  $d. '.csv';
        $delimiter = isset($args['delimiter'])?$args['delimiter'] : ';';
        $titlerow = array();
        $groups = false;
        $titlerow[] ="uname";
        $sql = "SELECT uid, uname";
        foreach ($optFields as $key => $value) {
            if ($value) {
                if ($key != "export_groups") $sql .= ",". $key; 
                // generate CSV header line
                switch ($key) {
                    case "activated" :
                        $titlerow[] ="activated";
                        break;
                    case "email":
                        $titlerow[] ="email";
                        break;
                    case "iw_nom":
                        $titlerow[] ="firstname";
                        break;
                    case "iw_cognom1":
                        $titlerow[] ="lastname1";
                        break;
                    case "iw_cognom2":
                        $titlerow[] ="lastname2";
                        break;
                    case "iw_naixement":
                        $titlerow[] ="birthdate";
                        break;
                    case "iw_sex":
                        $titlerow[] ="gender";
                        break;
                    case "export_groups":
                        $titlerow[] ="in";
                        $groups = true;
                        break;                    
                }
            }
        }
        $sql.= " FROM users, IWusers WHERE uid = iw_uid";
        // Get users info
        $rs = DBUtil::executeSQL($sql);
        $rsm = DBUtil::marshallObjects($rs);
        // Get groups from every user
//        if ($groups) {
        foreach ($rsm as $key => $user){
            if ($groups) {
                // Get all groups
                $rsm[$key]['in'] = UserUtil::getGroupListForUser($user['uid'], "|"); 
            }
            // Remove uid field
            array_splice($rsm[$key], 0, 1);
        }
        $result = array();
        FileUtil::exportCSV($rsm, $titlerow, $delimiter, '"', $filename);
        return true; //$result;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:60,代码来源:Admin.php

示例14: mediashare_vfs_dbapi_getMedia

function mediashare_vfs_dbapi_getMedia($args)
{
    $dom = ZLanguage::getModuleDomain('mediashare');
    $fileref = DataUtil::formatForStore($args['fileref']);
    $pntable = pnDBGetTables();
    $mediaTable = $pntable['mediashare_media'];
    $mediaColumn = $pntable['mediashare_media_column'];
    $storageTable = $pntable['mediashare_mediastore'];
    $storageColumn = $pntable['mediashare_mediastore_column'];
    $mediadbTable = $pntable['mediashare_mediadb'];
    $mediadbColumn =& $pntable['mediashare_mediadb_column'];
    $sql = "SELECT db.{$mediadbColumn['data']},\n                   store.{$storageColumn['mimeType']},\n                   store.{$storageColumn['bytes']},\n                   media.{$mediaColumn['id']},\n                   media.{$mediaColumn['parentAlbumId']},\n                   media.{$mediaColumn['title']},\n                   media.{$mediaColumn['modifiedDate']}\n              FROM {$mediadbTable} db\n         LEFT JOIN {$storageTable} store\n                ON store.{$storageColumn['fileRef']} = db.{$mediadbColumn['fileref']}\n         LEFT JOIN {$mediaTable} media\n                ON (media.{$mediaColumn['thumbnailId']} = store.{$storageColumn['id']}\n                    OR media.{$mediaColumn['previewId']} = store.{$storageColumn['id']}\n                    OR media.{$mediaColumn['originalId']} = store.{$storageColumn['id']})\n               AND media.{$mediaColumn['title']} IS NOT NULL\n             WHERE db.{$mediadbColumn['fileref']} = '{$fileref}'";
    $result = DBUtil::executeSQL($sql);
    if ($result === false) {
        return LogUtil::registerError(__f('Error in %1$s: %2$s.', array('vfsHandlerDB.getMedia', 'Could not retrieve the file information.'), $dom));
    }
    if (!$result) {
        return LogUtil::registerError(__('Unknown media item.', $dom));
    }
    $info = DBUtil::marshallObjects($result, array('data', 'mimeType', 'bytes', 'mediaId', 'albumId', 'title', 'modifiedDate'));
    return $info;
}
开发者ID:ro0f,项目名称:Mediashare,代码行数:22,代码来源:pnvfs_dbapi.php

示例15: contentUpgrade_4_1_2

 protected function contentUpgrade_4_1_2($oldVersion)
 {
     $dbtables = DBUtil::getTables();
     $searchableTable = $dbtables['content_searchable'];
     $searchableColumn = $dbtables['content_searchable_column'];
     // add new primary key field and a language field
     $sql = 'ALTER TABLE `' . $searchableTable . '` CHANGE `search_cid` `search_cid` INT(11) NOT NULL;';
     if (!DBUtil::executeSQL($sql)) {
         return LogUtil::registerError($this->__('Error! Could not update searchable table (1).'));
     }
     $sql = 'ALTER TABLE `' . $searchableTable . '` DROP PRIMARY KEY;';
     if (!DBUtil::executeSQL($sql)) {
         return LogUtil::registerError($this->__('Error! Could not update searchable table (2).'));
     }
     $sql = 'ALTER TABLE `' . $searchableTable . '` ADD `search_sid` INT(11) NOT NULL PRIMARY KEY AUTO_INCREMENT FIRST;';
     if (!DBUtil::executeSQL($sql)) {
         return LogUtil::registerError($this->__('Error! Could not update searchable table (3).'));
     }
     $sql = 'ALTER TABLE `' . $searchableTable . '` ADD `search_language` VARCHAR(10) NOT NULL AFTER `search_text`;';
     if (!DBUtil::executeSQL($sql)) {
         return LogUtil::registerError($this->__('Error! Could not update searchable table (4).'));
     }
     // update existing searchable data setting the default language code
     $defaultLanguage = System::getVar('language_i18n');
     $sql = "UPDATE `{$searchableTable}` SET `search_language` = '{$defaultLanguage}';";
     if (!DBUtil::executeSQL($sql)) {
         return LogUtil::registerError($this->__('Error! Could not update searchable table (5).'));
     }
     // check if we need to insert searchable rows for existing translations
     $multilingual = System::getVar('multilingual');
     if ($multilingual) {
         // retrieve existing translation languages
         $contentTable = $dbtables['content_content'];
         $contentColumn = $dbtables['content_content_column'];
         $translatedTable = $dbtables['content_translatedcontent'];
         $translatedColumn = $dbtables['content_translatedcontent_column'];
         $sql = "\n                SELECT DISTINCT {$translatedColumn['language']}\n                FROM {$translatedTable} t";
         $dbresult = DBUtil::executeSQL($sql);
         $languages = DBUtil::marshallObjects($dbresult);
         $cols = DBUtil::_getAllColumns('content_content');
         $ca = DBUtil::getColumnsArray('content_content');
         $ca[] = 'translated';
         // iterate translations
         foreach ($languages as $language) {
             // exclude the default language, since a page could have been created using another default language
             if ($language == $defaultLanguage) {
                 continue;
             }
             // get all translations for this language
             $sql = "\n                    SELECT {$cols}, {$translatedColumn['data']} AS translated\n                    FROM {$contentTable} c\n                    LEFT JOIN {$translatedTable} t\n                    AND t.{$translatedColumn['language']} = '{$language}'";
             $dbresult = DBUtil::executeSQL($sql);
             $content = DBUtil::marshallObjects($dbresult, $ca);
             $view = Zikula_View::getInstance('Content');
             $contentApi = new Content_Api_Content(ServiceUtil::getManager());
             for ($i = 0, $cou = count($content); $i < $cou; ++$i) {
                 $c =& $content[$i];
                 $c['data'] = empty($c['data']) ? null : unserialize($c['data']);
                 $c['translated'] = empty($c['translated']) ? null : unserialize($c['translated']);
                 // set translation as plugin content
                 if (is_array($c['translated']) && is_array($c['data'])) {
                     $c['data'] = array_merge($c['data'], $c['translated']);
                 }
                 // get access to the content plugin
                 $contentPlugin = $contentApi->getContentPlugin($c, $view);
                 // check if content is translatable
                 if (!$contentPlugin || !$contentPlugin->isTranslatable()) {
                     continue;
                 }
                 // extract searchable text
                 $text = $contentPlugin->getSearchableText();
                 // insert into searchable table
                 $searchObj = array('contentId' => $c['id'], 'text' => $text, 'language' => $language);
                 DBUtil::insertObject($searchObj, 'content_searchable', 'searchableId');
             }
         }
     }
     return true;
 }
开发者ID:robbrandt,项目名称:Content,代码行数:78,代码来源:Installer.php


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