<?php /* Widget List $tipe = cari | Form Pencarian $tipe = populer | Postingan Terpopuler $tipe = kategori | List Katergori $tipe = poling | Polling / Voting $tipe = download | List Download $tipe = agenda | List Agenda $tipe = komentar | Komentar Terbaru $tipe = banner | Banner List Edit Widget => FolderTemplate/widgets.php */ ?> <div id="sidebar"> <?php /* Menambahkan widget di sidebar echo add_widget('$tipe','sidebar'); */ echo add_widget('kategori', 'sidebar'); echo add_widget('populer', 'sidebar'); echo add_widget('agenda', 'sidebar'); echo add_widget('banner', 'sidebar'); ?> </div>
/** * Reorders the widgets from a widget panel * * @param string $panelstring1 String of guids of ElggWidget objects separated by :: * @param string $panelstring2 String of guids of ElggWidget objects separated by :: * @param string $panelstring3 String of guids of ElggWidget objects separated by :: * @param string $context Profile or dashboard * @param int $owner Owner guid * * @return void * @deprecated 1.8 Don't use. */ function reorder_widgets_from_panel($panelstring1, $panelstring2, $panelstring3, $context, $owner) { elgg_deprecated_notice("reorder_widgets_from_panel() is deprecated", 1.8); $return = true; $mainwidgets = explode('::', $panelstring1); $sidewidgets = explode('::', $panelstring2); $rightwidgets = explode('::', $panelstring3); $handlers = array(); $guids = array(); if (is_array($mainwidgets) && sizeof($mainwidgets) > 0) { foreach ($mainwidgets as $widget) { $guid = (int) $widget; if ("{$guid}" == "{$widget}") { $guids[1][] = $widget; } else { $handlers[1][] = $widget; } } } if (is_array($sidewidgets) && sizeof($sidewidgets) > 0) { foreach ($sidewidgets as $widget) { $guid = (int) $widget; if ("{$guid}" == "{$widget}") { $guids[2][] = $widget; } else { $handlers[2][] = $widget; } } } if (is_array($rightwidgets) && sizeof($rightwidgets) > 0) { foreach ($rightwidgets as $widget) { $guid = (int) $widget; if ("{$guid}" == "{$widget}") { $guids[3][] = $widget; } else { $handlers[3][] = $widget; } } } // Reorder existing widgets or delete ones that have vanished foreach (array(1, 2, 3) as $column) { if ($dbwidgets = get_widgets($owner, $context, $column)) { foreach ($dbwidgets as $dbwidget) { if (in_array($dbwidget->getGUID(), $guids[1]) || in_array($dbwidget->getGUID(), $guids[2]) || in_array($dbwidget->getGUID(), $guids[3])) { if (in_array($dbwidget->getGUID(), $guids[1])) { $pos = array_search($dbwidget->getGUID(), $guids[1]); $col = 1; } else { if (in_array($dbwidget->getGUID(), $guids[2])) { $pos = array_search($dbwidget->getGUID(), $guids[2]); $col = 2; } else { $pos = array_search($dbwidget->getGUID(), $guids[3]); $col = 3; } } $pos = ($pos + 1) * 10; $dbwidget->column = $col; $dbwidget->order = $pos; } else { $dbguid = $dbwidget->getGUID(); if (!$dbwidget->delete()) { $return = false; } else { // Remove state cookie setcookie('widget' + $dbguid, null); } } } } // Add new ones if (sizeof($guids[$column]) > 0) { foreach ($guids[$column] as $key => $guid) { if ($guid == 0) { $pos = ($key + 1) * 10; $handler = $handlers[$column][$key]; if (!add_widget($owner, $handler, $context, $pos, $column)) { $return = false; } } } } } return $return; }
<?php /** * Elgg widget add action * * @package Elgg * @subpackage Core * @author Curverider Ltd * @link http://elgg.org/ */ $guid = get_input('user'); $handler = get_input('handler'); $context = get_input('context'); $column = get_input('column'); $result = false; if (!empty($guid)) { if ($user = get_entity($guid)) { if ($user->canEdit()) { $result = add_widget($user->getGUID(), $handler, $context, 0, $column); } } } if ($result) { system_message(elgg_echo('widgets:save:success')); } else { register_error(elgg_echo('widgets:save:failure')); } forward($_SERVER['HTTP_REFERER']);
/** * Extends the create user event to add admin defined widgets to the dashboard/profile context */ function defaultwidgets_newusers($event, $object_type, $object) { // turn on permissions override global $defaultwidget_access, $CONFIG; $defaultwidget_access = true; // get the new user guid $guid = $object->guid; if (isadminloggedin()) { // this is an admin-created user // no permissions problems, so set proper access now // use system default access (not the admin's default access!, because that could be a personal access level) $widget_access = $CONFIG->default_access; } else { // this is a regular registration // set widget access to public for now and reset it properly during the validate event // to avoid Elgg permissions problems $widget_access = ACCESS_PUBLIC; } // check if it's set if (!empty($guid)) { // get the user entity if ($user = get_entity($guid)) { // can this user edit if ($user->canEdit()) { // each of the contexts to add widgets for $contexts = array('profile', 'dashboard'); // get the entities for the module $entities = get_entities("object", "moddefaultwidgets", 0, "", 9999); // check if the entity exists if (isset($entities[0])) { // get the widgets for the context $entity = $entities[0]; foreach ($contexts as $context) { $current_widgets = $entity->{$context}; list($left, $middle, $right) = split('%%', $current_widgets); // split columns into seperate widgets $area1widgets = split('::', $left); $area2widgets = split('::', $middle); $area3widgets = split('::', $right); // clear out variables if no widgets are available if ($area1widgets[0] == "") { $area1widgets = false; } if ($area2widgets[0] == "") { $area2widgets = false; } if ($area3widgets[0] == "") { $area3widgets = false; } // generate left column widgets for a new user foreach ($area1widgets as $i => $widget) { add_widget($guid, $widget, $context, $i + 1, 1, $widget_access); } // generate middle column widgets for a new user foreach ($area2widgets as $i => $widget) { add_widget($guid, $widget, $context, $i + 1, 2, $widget_access); } // generate right column widgets for a new user foreach ($area3widgets as $i => $widget) { add_widget($guid, $widget, $context, $i + 1, 3, $widget_access); } } } } } } // turn off permissions override $defaultwidget_access = false; }
<?php error_reporting(0); include "" . $f[folder] . "/header.php"; include "" . $f[folder] . "/widgets.php"; include "" . $f[folder] . "/script/pageNavi.php"; ?> <div id="page"> <div class="inner"> <?php if ($_GET['module'] == 'home') { ?> <!-- Bagian Redaksi --> <?php echo add_widget('redaksi', 'sidebar'); ?> <!-- Bagian Redaksi --> <?php } ?> <?php include "" . $f[folder] . "/content.php"; ?> <?php include "" . $f[folder] . "/sidebar.php"; ?> <?php if ($_GET['module'] == 'detailberita') { include "" . $f[folder] . "/comments.php"; } ?>
<?php if ($_GET['module'] == 'home') { ?> <div id="content"> <div class="title"> <?php echo add_widget('cari', 'sidebar'); ?> <h2>Berita Terbaru</h2> </div> <?php // Berita Sebelumnya (tampilkan 5 berita terbaru) $sebelum = mysql_query("SELECT COUNT(komentar.id_komentar) AS jml, judul, judul_seo, jam, \n berita.id_berita, hari, tanggal, gambar, isi_berita \n FROM berita LEFT JOIN komentar \n ON berita.id_berita = komentar.id_berita\n AND aktif = 'Y' \n GROUP BY berita.id_berita DESC LIMIT 0,5"); while ($t = mysql_fetch_array($sebelum)) { ?> <div id="post"> <?php // Apabila ada gambar dalam berita, tampilkan if ($t['gambar'] != '') { ?> <a class="thumb" href="berita-<?php echo $t[id_berita]; ?> -<?php echo $t[judul_seo]; ?> .html"> <img src="<?php echo $f[folder]; ?>
$tipe = agenda | List Agenda $tipe = komentar | Komentar Terbaru $tipe = banner | Banner List Edit Widget => FolderTemplate/widgets.php */ ?> <div id="footer"> <div class="inner"> <?php /* Menambahkan widget di sidebar echo add_widget('$tipe','sidebar'); MAX WIDGET = 3 */ echo add_widget('populer', 'footer'); echo add_widget('komentar', 'footer'); echo add_widget('agenda', 'footer'); ?> <div class="clearboth"></div> </div> </div> <div id="footer-copyright"> <div class="inner"> Copyright © 2011 <a href="http://nugi.me/">Ahmad Nugraha</a> - Powered by <a href="http://bukulokomedia.com">CMS Lokomedia</a> </div> </div>