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


PHP PHPWS_Core::plugObject方法代码示例

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


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

示例1: loadChildren

 /**
  * Grabs all the child links under the current link
  */
 public function loadChildren($data = null, $hash = null)
 {
     // If we're doing this the old, inefficient way...
     if (empty($data) || empty($hash)) {
         $db = $this->getDB();
         $db->addWhere('parent', $this->id);
         $db->addOrder('link_order');
         Key::restrictView($db);
         $result = $db->getObjects('menu_link');
         if (empty($result)) {
             return;
         }
         foreach ($result as $link) {
             $link->loadChildren();
             $this->_children[$link->id] = $link;
         }
     } elseif (empty($hash[$this->id])) {
         return;
     } else {
         foreach ($hash[$this->id] as $rowId) {
             $link = new Menu_Link();
             PHPWS_Core::plugObject($link, $data[$rowId]);
             $link->loadChildren($data, $hash);
             $this->_children[$link->id] = $link;
         }
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:30,代码来源:Menu_Link.php

示例2: runQuery

 protected static function runQuery($db)
 {
     self::joinAll($db);
     $db->addColumn('analytics_tracker.*');
     $result = $db->select();
     if (PHPWS_Error::logIfError($result)) {
         return FALSE;
     }
     $trackers = array();
     foreach ($result as $tracker) {
         $found = PHPWS_Core::initModClass('analytics', "trackers/{$tracker['type']}.php");
         if (!$found) {
             continue;
         }
         $t = new $tracker['type']();
         PHPWS_Core::plugObject($t, $tracker);
         $trackers[] = $t;
     }
     return $trackers;
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:20,代码来源:TrackerFactory.php

示例3: approveSuggestion

 public function approveSuggestion($id)
 {
     if (!Current_User::authorized('calendar', 'edit_public') || Current_User::isRestricted('calendar')) {
         PHPWS_Core::errorPage('403');
     }
     PHPWS_Core::initModClass('calendar', 'Suggestion.php');
     $suggestion = new Calendar_Suggestion((int) $id);
     if (!$suggestion->id) {
         PHPWS_Core::errorPage('404');
     }
     $values = PHPWS_Core::stripObjValues($suggestion);
     unset($values['id']);
     $event = new Calendar_Event();
     $event->loadSchedule($suggestion->schedule_id);
     $event->public = 1;
     PHPWS_Core::plugObject($event, $values);
     $result = $event->save();
     if (PHPWS_Error::isError($result)) {
         PHPWS_Error::log($result);
         return false;
     }
     $suggestion->delete();
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:23,代码来源:Admin.php

示例4: getObjects

 /**
  * Creates an array of objects constructed from the submitted
  * class name.
  *
  * Use this function instead of select() to get an array of objects.
  * Note that your class variables and column names MUST match exactly.
  * Unmatched pairs will be ignored.
  *
  * --- Any extra parameters after class_name are piped into ---
  * --- a class method called postPlug. If the function    ---
  * --- does not exist, nothing happens. Previously, the     ---
  * --- the variables were put into the constructor.         ---
  * Example:
  * $db->getObjects('Class_Name', 'foo');
  * class Class_Name {
  * function postPlug($extra_param) {
  * } // end constuctor
  * } //end class
  *
  * @author Matthew McNaney <mcnaney at gmail dot com>
  * @param string $class_name Name of class used in object
  * @return array $items      Array of objects
  * @access public
  */
 public function getObjects($class_name)
 {
     $items = null;
     $result = $this->select();
     if (empty($result)) {
         return null;
     }
     if (PHPWS_Error::isError($result) || !isset($result)) {
         return $result;
     }
     $this->requireClasses();
     if (!class_exists($class_name)) {
         return PHPWS_Error::get(PHPWS_CLASS_NOT_EXIST, 'core', 'PHPWS_DB::getObjects', $class_name);
     }
     $num_args = func_num_args();
     if ($num_args > 1) {
         $args = func_get_args();
         array_shift($args);
     } else {
         $args = null;
     }
     foreach ($result as $indexby => $itemResult) {
         $genClass = new $class_name();
         if (isset($itemResult[0]) && is_array($itemResult[0])) {
             foreach ($itemResult as $key => $sub) {
                 $genClass = new $class_name();
                 PHPWS_Core::plugObject($genClass, $sub, $args);
                 $items[$indexby][] = $genClass;
             }
         } else {
             PHPWS_Core::plugObject($genClass, $itemResult, $args);
             $items[$indexby] = $genClass;
         }
     }
     return $items;
 }
开发者ID:jeffrafter,项目名称:InternshipInventory,代码行数:60,代码来源:SubselectDatabase.php

示例5: loadSections

 public function loadSections($form_mode = false, $filler = true)
 {
     PHPWS_Core::initModClass('pagesmith', 'PS_Text.php');
     PHPWS_Core::initModClass('pagesmith', 'PS_Block.php');
     if (empty($this->_tpl)) {
         $this->loadTemplate();
     }
     if (empty($this->_tpl->structure)) {
         PHPWS_Error::log(PS_PG_TPL_ERROR, 'pagesmith', 'PS_Page::loadSections', $this->_tpl->file);
         throw new \Exception('Page template missing:' . $this->_tpl->file);
     }
     foreach ($this->_tpl->structure as $section_xml) {
         switch ($section_xml['TYPE']) {
             case 'image':
             case 'document':
             case 'media':
             case 'block':
                 $section = new PS_Block();
                 $section->pid = $this->id;
                 break;
             default:
                 $section = new PS_Text();
                 $section->pid = $this->id;
         }
         $section->plugSection($section_xml, $this->id);
         if ($form_mode && $filler) {
             $section->loadFiller();
         }
         $this->_sections[$section->secname] = $section;
     }
     if ($this->id) {
         // load sections from database
         // load sections should handle template
         $text_db = new PHPWS_DB('ps_text');
         $block_db = new PHPWS_DB('ps_block');
         $text_db->addWhere('pid', $this->id);
         $block_db->addWhere('pid', $this->id);
         $text_db->setIndexBy('secname');
         $block_db->setIndexBy('secname');
         $text_sections = $text_db->select();
         $block_sections = $block_db->select();
         if (!empty($text_sections)) {
             foreach ($text_sections as $secname => $section) {
                 if (isset($this->_sections[$secname])) {
                     PHPWS_Core::plugObject($this->_sections[$secname], $section);
                     // we don't want smarttags parsed
                     $this->_content[$secname] = $this->_sections[$secname]->getContent(!$form_mode);
                 } elseif (!empty($section['content'])) {
                     $this->_orphans[$secname] = $section;
                 } else {
                     $db = \Database::newDB();
                     $db->setConditional($db->addTable('ps_text')->getFieldConditional('id', $section['id']));
                     $db->delete();
                 }
             }
         }
         if (!empty($block_sections)) {
             foreach ($block_sections as $secname => $section) {
                 if (isset($this->_sections[$secname])) {
                     if ($this->_sections[$secname]->width) {
                         $default_w = $this->_sections[$secname]->width;
                     }
                     if ($this->_sections[$secname]->height) {
                         $default_h = $this->_sections[$secname]->height;
                     }
                     PHPWS_Core::plugObject($this->_sections[$secname], $section);
                     if ($this->_sections[$secname]->width && !empty($default_w)) {
                         $this->_sections[$secname]->width = $default_w;
                     }
                     if ($this->_sections[$secname]->height && !empty($default_h)) {
                         $this->_sections[$secname]->height = $default_h;
                     }
                     if ($form_mode && $this->_sections[$secname]->type_id) {
                         //reload the image form if the image is set
                         $this->_sections[$secname]->loadFiller();
                     }
                     $this->_content[$secname] = $this->_sections[$secname]->getContent();
                 } elseif ($section['type_id'] > 0) {
                     $this->_orphans[$secname] = $section;
                 } else {
                     $db = \Database::newDB();
                     $db->setConditional($db->addTable('ps_block')->getFieldConditional('id', $section['id']));
                     $db->delete();
                 }
             }
         }
     }
 }
开发者ID:sysulsj,项目名称:phpwebsite,代码行数:88,代码来源:PS_Page.php

示例6: plugObject

 public function plugObject($obj)
 {
     return PHPWS_Core::plugObject($obj, $this->params);
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:4,代码来源:CommandContext.php

示例7: removeFromMenu

 private function removeFromMenu()
 {
     $key_id = $this->page->key_id;
     $link = new Menu_Link();
     $db = Database::getDB();
     $t1 = $db->addTable('menu_links');
     $t1->addFieldConditional('key_id', $key_id);
     $link_result = $db->selectOneRow();
     if (empty($link_result)) {
         return;
     }
     PHPWS_Core::plugObject($link, $link_result);
     $link->delete();
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:14,代码来源:PageSmith.php

示例8: categoryView

 public static function categoryView()
 {
     $active_menu = self::getCurrentActiveMenu();
     if ($active_menu == 0) {
         $menu_tpl['home_active'] = 1;
     } else {
         $menu_tpl['home_active'] = 0;
     }
     $db = \Database::newDB();
     $m = $db->addTable('menus');
     $k = $db->addTable('phpws_key');
     $k->addField('url');
     $db->joinResources($m, $k, $db->createConditional($m->getField('assoc_key'), $k->getField('id'), '='), 'left');
     $m->addOrderBy($m->getField('queue'));
     $key = \Key::getCurrent();
     if ($key && $key->id) {
         $current_key_id = $key->id;
     } else {
         $current_key_id = -1;
     }
     $menus = $db->select();
     if (empty($menus)) {
         return;
     }
     foreach ($menus as $m) {
         $menu = new Menu_Item();
         PHPWS_Core::plugObject($menu, $m);
         $menu->_show_all = true;
         if (empty($menu->assoc_url)) {
             $menu->setAssocUrl($m['url']);
         }
         // if the current menu matches a used link (either by it being in the
         // in the menu or associated to it) mark as ACTIVE
         $active = $active_menu == $menu->id || $current_key_id == $menu->assoc_key ? 1 : 0;
         // if there is not an assoc key, them menu is using drop downs, so
         // we do not add the side menu
         if ($active) {
             if ($menu->assoc_key) {
                 Layout::set($menu->view(), 'menu', 'side');
             }
             if ($menu->assoc_image) {
                 Layout::set($menu->showAssocImage(), 'menu', 'image');
             }
         }
         $menu_tpl['menus'][] = self::getCategoryViewLine($menu, $active);
     }
     $template = new \Template($menu_tpl);
     \Layout::addJSHeader("<script type='text/javascript' src='" . PHPWS_SOURCE_HTTP . "javascript/responsive_img/responsive-img.min.js'></script>", 81);
     $template->setModuleTemplate('menu', 'category_view/category_menu.html');
     \Layout::add($template->get(), 'menu', 'top_view');
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:51,代码来源:Menu.php

示例9: roomSearch

 protected function roomSearch($gender = FALSE, $lifestyle = FALSE, $pbuilding = FALSE, $pfloor = FALSE, $proom = FALSE)
 {
     $pre_sql = "SELECT hms_room.*, sub.banner_building_code FROM (SELECT hms_room.id, hms_residence_hall.banner_building_code ,  (count(hms_bed.id)) AS bed_count FROM hms_residence_hall INNER JOIN hms_floor ON hms_residence_hall.id = hms_floor.residence_hall_id  INNER JOIN hms_room ON hms_floor.id = hms_room.floor_id  INNER JOIN hms_bed ON hms_room.id = hms_bed.room_id  LEFT OUTER JOIN hms_assignment ON hms_bed.id = hms_assignment.bed_id WHERE hms_assignment.asu_username IS NULL AND hms_room.offline = 0 AND hms_room.reserved = 0 AND hms_room.ra = 0 AND hms_room.overflow = 0 AND hms_room.private = 0 AND hms_room.parlor = 0 AND hms_room.term = '{$this->term}' AND hms_floor.is_online = 1 AND hms_residence_hall.is_online = 1 ";
     $post_sql = " GROUP BY hms_residence_hall.banner_building_code, hms_room.id) AS sub INNER JOIN hms_room ON sub.id = hms_room.id WHERE sub.bed_count = 2 ORDER BY random() LIMIT 1";
     // Limit to selection
     $moar = array();
     if ($gender !== FALSE) {
         $moar[] = " hms_room.gender_type = {$gender} ";
     }
     if ($lifestyle !== FALSE) {
         $lf = $lifestyle == 2 ? '=' : '!=';
         $moar[] = " hms_residence_hall.gender_type {$lf} 2 ";
     }
     if ($pbuilding !== FALSE) {
         $moar[] = " hms_residence_hall.banner_building_code = '{$pbuilding}' ";
     }
     if ($pfloor !== FALSE) {
         $moar[] = " hms_floor.floor_number = '{$pfloor}' ";
     }
     if ($proom !== FALSE) {
         $moar[] = " hms_room.room_number = '{$proom}' ";
     }
     // Assemble SQL
     $sql = $pre_sql . (count($moar) > 0 ? ' AND ' . implode(' AND ', $moar) : '') . $post_sql;
     $db = new PHPWS_DB();
     $db->setSQLQuery($sql);
     $result = $db->select('row');
     if (PHPWS_Error::logIfError($result)) {
         throw new DatabaseException($result->getMessage());
     }
     if (is_null($result)) {
         return null;
     }
     $room = new HMS_Room();
     PHPWS_Core::plugObject($room, $result);
     return $room;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:37,代码来源:AssignmentStrategy.php

示例10: controlpanel_update


//.........这里部分代码省略.........
----------------
+ Control panel will now direct a user to login if their session times
  out during panel view.
+ Changed icon image layout a touch to try and make more space.
+ A tab link can be now be sent in strict mode to prevent appending.
</pre>';
        case version_compare($currentVersion, '2.1.3', '<'):
            $content[] = '<pre>';
            $content[] = '2.1.3 changes
----------------
+ Developers can now add a link_title to quickSetTabs. This allows the
  user to mouse over tabs to get extended information.
</pre>';
        case version_compare($currentVersion, '2.1.4', '<'):
            $content[] = '<pre>';
            cpFileUpdate(array('templates/default.tpl'), $content);
            $content[] = '2.1.4 changes
----------------
+ Panel::display now includes the options to send content, title, and
  message information to be put in a default template.
</pre>';
        case version_compare($currentVersion, '2.1.5', '<'):
            $content[] = '<pre>';
            cpFileUpdate(array('templates/default.tpl'), $content);
            $content[] = '2.1.5 changes
----------------
+ Commented out title in default template.
+ A module can force a control panel tab using the second parameter in
  the display function.
</pre>';
        case version_compare($currentVersion, '2.1.6', '<'):
            $content[] = '<pre>';
            cpFileUpdate(array('templates/style.css'), $content);
            $content[] = '2.1.6 changes
----------------
+ Changed tab formatting. The a tag is padded to make clickable area
  larger.</pre>';
        case version_compare($currentVersion, '2.2.0', '<'):
            $content[] = '<pre>';
            cpFileUpdate(array('javascript/subpanel/', 'templates/subpanel.tpl'), $content);
            $content[] = '2.2.0 changes
----------------
+ Flyout menu added to control panel link.
+ Added function to return control panel link.
+ Moved controlpanel unregisteration to control panel class.
+ php 5 format changes</pre>';
        case version_compare($currentVersion, '2.2.1', '<'):
            $content[] = '<pre>
2.2.1 changes
-------------------------
+ Added a little hack suggested by Hilmar to allow controlpanel translation.
</pre>';
        case version_compare($currentVersion, '2.3.0', '<'):
            $db = new PHPWS_DB('controlpanel_link');
            $db->addColumn('id');
            $db->addColumn('image');
            $result = $db->select();
            foreach ($result as $link) {
                $db->addWhere('id', $link['id']);
                $db->addValue('image', preg_replace('@images/mod/\\w+/@', '', $link['image']));
                $db->update();
                $db->reset();
            }
            unset($_SESSION['CP_All_links']);
            $content[] = '<pre>2.3.0 changes
------------------
+ Links reindexed for core changes.</pre>';
        case version_compare($currentVersion, '2.3.1', '<'):
            $content[] = '<pre>2.3.1 changes
-------------------
+ Icon templating from Eloi.
</pre>';
        case version_compare($currentVersion, '2.3.2', '<'):
            $content[] = '<pre>2.3.2 changes
-------------------
+ Fixed javascript error.
</pre>';
        case version_compare($currentVersion, '2.3.3', '<'):
        case version_compare($currentVersion, '2.3.4', '<'):
            $link = new PHPWS_Panel_Link();
            $db = Database::newDB();
            $tbl = $db->addTable('controlpanel_link');
            $db->setConditional($tbl->getFieldConditional('itemname', 'controlpanel'));
            $db->loadSelectStatement();
            $row = $db->fetchOneRow();
            PHPWS_Core::plugObject($link, $row);
            $link->kill();
            $content[] = '<pre>2.3.3 &amp; 2.3.4 changes
-------------------
+ Removing Control Panel icon and removed admin options.
</pre>';
        case version_compare($currentVersion, '2.3.5', '<'):
            $content[] = '<pre>2.3.5 changes
-------------------
+ Removed unused templates
+ Added class names to panel.tpl to allow styling.
</pre>';
    }
    return true;
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:101,代码来源:update.php

示例11: plugInstance

 public static function plugInstance(array $data)
 {
     $f = self::getInstanceByName($data['name']);
     PHPWS_Core::plugObject($f, $data);
     return $f;
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:6,代码来源:ApplicationFeature.php

示例12: listOrphans

 private function listOrphans($orphans)
 {
     javascript('jquery');
     javascriptMod('pagesmith', 'delete_orphan');
     $tpl = array();
     $tpl['TITLE'] = dgettext('pagesmith', 'Orphaned content');
     foreach ($orphans as $orf) {
         $row = array();
         switch ($orf['sectype']) {
             case 'text':
             case 'header':
                 $row['ID'] = 'text-' . $orf['id'];
                 $sec = new PS_Text();
                 $empty_content = empty($orf['content']);
                 break;
             case 'image':
             case 'document':
             case 'media':
             case 'block':
                 $row['ID'] = 'block-' . $orf['id'];
                 $sec = new PS_Block();
                 $empty_content = empty($orf['type_id']);
                 break;
         }
         PHPWS_Core::plugObject($sec, $orf);
         if ($empty_content) {
             $row['CONTENT'] = sprintf('<em>%s</em>', dgettext('pagesmith', 'Empty content. Consider deletion.'));
         } else {
             $row['CONTENT'] = $sec->getContent();
         }
         $row['OPTIONS'] = sprintf('<a href="#" onclick="delete_orphan(\'%s\'); return false">%s</a>', $row['ID'], dgettext('pagesmith', 'Delete orphan'));
         $tpl['orphan-list'][] = $row;
     }
     return PHPWS_Template::process($tpl, 'pagesmith', 'orphans.tpl');
 }
开发者ID:par-orillonsoft,项目名称:phpwebsite,代码行数:35,代码来源:PS_Forms.php

示例13: removeKeyLink

 private function removeKeyLink(\Request $request)
 {
     $key_id = $request->getVar('key_id');
     $menu_id = $request->getVar('menu_id');
     $db = \Database::newDB();
     $ml = $db->addTable('menu_links');
     $ml->addFieldConditional('key_id', $key_id);
     $ml->addFieldConditional('menu_id', $menu_id);
     $links = $db->select();
     if (empty($links)) {
         throw \Exception('Menu link not found');
     }
     foreach ($links as $l) {
         $menu_link = new Menu_Link();
         PHPWS_Core::plugObject($menu_link, $l);
         $menu_link->delete();
     }
 }
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:18,代码来源:Menu_Admin.php


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