function get_links()
 {
     $data = array();
     $emblem_data = ModuleData::get('LogoModule');
     if ($emblem_data) {
         $data = unserialize($emblem_data);
     }
     return $data;
 }
 function get_links()
 {
     $data = array();
     $taketour_data = ModuleData::get('TakeTour');
     if ($taketour_data) {
         $data = unserialize($taketour_data);
     }
     return $data;
 }
 function generate_inner_html()
 {
     $links = ModuleData::get('LogoModule');
     if ($links) {
         $links = unserialize($links);
     }
     $tmp_file = dirname(__FILE__) . '/side_inner_public.tpl';
     $inner_html_gen =& new Template($tmp_file);
     $inner_html_gen->set('links', $links);
     $inner_html = $inner_html_gen->fetch();
     return $inner_html;
 }
 function generate_inner_html()
 {
     global $base_url, $current_blockmodule_path;
     $inner_template = NULL;
     switch ($this->mode) {
         default:
             $inner_template = dirname(__FILE__) . '/side_inner_public.tpl';
     }
     $links = ModuleData::get('TakeTour');
     if ($links) {
         $links = unserialize($links);
     }
     $obj_inner_template =& new Template($inner_template);
     $obj_inner_template->set('links', $links);
     $obj_inner_template->set('base_url', $base_url);
     $inner_html = $obj_inner_template->fetch();
     return $inner_html;
 }
 function generate_inner_html()
 {
     $inner_template = NULL;
     switch ($this->mode) {
         default:
             $inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/cnmodule_content.php';
     }
     $links = ModuleData::get('TakeTour');
     if (!empty($links)) {
         $links = unserialize($links);
     }
     if (empty($links) || !is_array($links)) {
         $this->do_skip = TRUE;
         return;
     }
     $obj_inner_template = new Template($inner_template);
     $obj_inner_template->set('links', $links);
     $inner_html = $obj_inner_template->fetch();
     return $inner_html;
 }
    function render()
    {
        $data = unserialize(ModuleData::get('showcase'));
        $u = $data['featured_user_name'];
        $upage = PA::$url . '/user/' . $u;
        $up = $data['auto_user_picture_url'];
        $g = TypedGroupEntity::load_for_group($data['featured_group_id']);
        $gname = $g->attributes["name"]["value"];
        $gpage = PA::$url . '/group/gid=' . $data['featured_group_id'];
        $gp = $g->attributes["logo"]["value"];
        //PUT VIDEO STUFF HERE
        $b = TypedGroupEntity::load_for_group($data['featured_business_id']);
        $bname = $b->attributes["name"]["value"];
        $bpage = PA::$url . '/group/gid=' . $data['featured_business_id'];
        $bp = $b->attributes["logo"]["value"];
        $table = '<table width="100%%" border="0" cellpadding="0" cellspacing="0" style="background-color:#fff; padding-top:3px; padding-bottom:10px; ">
					  <tr>
						<th colspan="4" align="center" style="background-color:#999; color:#dfe2e3; padding:4px 0 4px 0;" scope="col">Featured Bar</th>
					  </tr>
					  <tr style="color:#000;">
						<td align="center"><b>User</b></td>
						<td align="center"><b>Group</b></td>
						<td align="center"><b>Video</b></td>
						<td align="center"><b>Business</b></td>
					  </tr>
					  <tr>
						<td align="center">%s</td>
						<td align="center">%s</td>
						<td align="center">%s</td>
						<td align="center">%s</td>
					  </tr>
					</table>';
        $user = "******" . $upage . "'>" . uihelper_resize_mk_img($up, 100, 100, 'images/default.png', 'alt=PeopleAggregator') . "</a><h4>" . $data['featured_user_name'] . "</h4>";
        $group = "<a href='" . $gpage . "'>" . uihelper_resize_mk_img($gp, 100, 100, 'images/default.png', 'alt=PeopleAggregator') . "</a><h4>" . $gname . "</h4>";
        $video = "<a href='http://www.people.tdooner.com/'>" . uihelper_resize_mk_img('images/default.png', 100, 100, 'images/default.png', 'alt=PeopleAggregator') . "</a>";
        $business = "<a href='" . $bpage . "'>" . uihelper_resize_mk_img($bp, 100, 100, 'images/default.png', 'alt=PeopleAggregator') . "</a><h4>" . $bname . "</h4>";
        return sprintf($table, $user, $group, $video, $business);
    }
 /**
  * Get "copy code" for module data.
  *
  * @param ModuleData $moduleData
  * @return array
  */
 public static function getModuleDataCode(ModuleData $moduleData)
 {
     return array("inherited" => true, "template" => $moduleData->getTemplate(), "enabled" => $moduleData->getEnabled(), "data" => $moduleData->getData(), "langcode" => $moduleData->getLangcode());
 }
}
$login_required = FALSE;
$use_theme = 'Beta';
include_once "web/includes/page.php";
require_once "api/ModuleData/ModuleData.php";
require_once "web/dologin.php";
$configure = unserialize(ModuleData::get('configure'));
if (!isset($configure['show_splash_page']) || $configure['show_splash_page'] == INACTIVE) {
    $location = PA_ROUTE_HOME_PAGE;
    header("Location: {$location}");
    exit;
}
$module_name = 'SplashPage';
$configurable_sections = array('info_boxes', 'network_of_moment', 'video_tours', 'register_today', 'server_announcement', 'survey');
foreach ($configurable_sections as $key => $section) {
    ${$section} = unserialize(ModuleData::get($section));
}
// Display welcome Message if logged in, otherwise show login prompt
if (PA::logged_in() || !isset($configure['show_splash_page']) || $configure['show_splash_page'] == INACTIVE) {
    $uname = $user->get_name();
    $message = "Welcome, {$uname}! <a href='logout.php'>Logout</a>";
} else {
    $message = ' <form action="dologin.php?action=login" method="post" style="margin: 0px;">
         <input type="hidden" name="InvID" value=""/>
         <input type="hidden" name="GInvID" value=""/>
         Username<input type="text" name="username"/>
         Password<input type="password" name="password"/>
         <input type="submit" value="login"/>
         or
         <a href="register.php">REGISTER</a></form>';
}
            if (!empty($_POST['current_network_image'])) {
                //getting the previously added image from the hidden form field.
                $networks_data['network_image'] = $_POST['current_network_image'];
            } else {
                //setting the image to null.
                $networks_data['network_image'] = null;
            }
        }
    }
    $networks_data = serialize($networks_data);
    if ($action == 'save') {
        ModuleData::save($networks_data, $section);
    } else {
        ModuleData::update($networks_data, $section);
    }
    $networks_data = ModuleData::get($section);
    $networks_data = unserialize($networks_data);
    //TODO: display the error messages.
}
//end if
function setup_module($column, $module, $obj)
{
    global $featured_network, $info_boxes, $networks_data, $section, $perm;
    $obj->perm = $perm;
    switch ($module) {
        default:
            $obj->mode = $section;
            $obj->info_boxes = $info_boxes;
            $obj->networks_data = $networks_data;
    }
}
 /**
  * Internal function to add a ModuleData object.
  *
  * @param ModuleData $moduleData
  */
 protected function addData(ModuleData $moduleData)
 {
     if ($moduleData->getTemplate() !== NULL) {
         $this->template = $moduleData->getTemplate();
         $this->templateSourceId = $moduleData->getModuleDataId();
     }
     if ($moduleData->getEnabled() !== NULL) {
         $this->enabled = $moduleData->getEnabled();
         $this->enabledSourceId = $moduleData->getModuleDataId();
     }
     if ($moduleData->getData() !== NULL) {
         $this->data = $moduleData->getData();
         $this->dataSourceId = $moduleData->getModuleDataId();
     }
 }
        }
        if ($_POST['caption'][$i]) {
            $data[$i]['title'] = $_POST['caption'][$i];
        }
        if (!empty($_FILES['userfile_' . $i]['name'])) {
            $data[$i]['file_name'] = $file;
            Storage::link($file, array("role" => "emblem"));
        } else {
            $data[$i]['file_name'] = $_POST['userimage_' . $i];
        }
    }
    $data = serialize($data);
    $id = 1;
    // stands for the Update for emblum data
    if (!$error) {
        ModuleData::update($data, $id);
        // call the ModuleData to update the data
    }
}
//render the page
$page = new PageRenderer("setup_module", PAGE_MANAGE_EMBLEM, "Manage Emblem", 'container_two_column.tpl', 'header.tpl', PRI, HOMEPAGE, PA::$network_info);
if (!empty($msg)) {
    $msg_tpl = new Template(CURRENT_THEME_FSPATH . "/display_message.tpl");
    $msg_tpl->set('message', $msg);
    $m = $msg_tpl->fetch();
    $page->add_module("middle", "top", $m);
}
$page->html_body_attributes = 'class="no_second_tier network_config"';
$page->add_header_html(js_includes('edit_profile.js'));
$page->add_header_html(js_includes('manage_data.js'));
$css_array = get_network_css();
 function __construct($cb, $page_id, $title, $page_template = "homepage_pa.tpl", $header_template = "header.tpl", $default_mode = PRI, $default_block_type = HOMEPAGE, $network_info_ = NULL, $onload = NULL, $setting_data = NULL)
 {
     global $app, $page;
     if (PA::$profiler) {
         PA::$profiler->startTimer('PageRenderer_init');
     }
     // we may want to know the page_tpe elsewhere too
     PA::$config->page_type = $page_id;
     // NOTE: PA::$config->page_type var = $page_id and should be removed!
     $this->page_id = $page_id;
     $this->debugging = isset($_GET['debug']);
     $this->page_template = $page_template;
     $this->top_navigation_template = 'top_navigation_bar.tpl';
     //TO DO: Remove this hardcoded text afterwards
     $this->header_template = $header_template;
     //settings for current network
     $this->network_info = $network_info_ ? $network_info_ : PA::$network_info;
     //FIXME: does this have to be a parameter?  can't we just always use the global PA::$network_info?
     $this->module_arrays = array();
     // the function hide_message_window is added here
     // so whenever html page is loaded the message window's ok button gets focus
     // here if previouly some function is defined as
     // onload = "ajax_call_method(ajax_titles, $uid, ajax_urls);"
     // now it will look like
     // onload = "ajax_call_method(ajax_titles, $uid, ajax_urls); hide_message_window();"
     $this->onload = "{$onload} hide_message_window('confirm_btn');";
     $this->page_title = $title;
     $this->html_body_attributes = "";
     // default settings for the tiers
     $this->main_tier = @$_GET['tier_one'];
     $this->second_tier = @$_GET['tier_two'];
     $this->third_tier = @$_GET['tier_three'];
     $navigation = new Navigation();
     $this->navigation_links = $navigation->get_links();
     $this->message_count = null;
     if (!isset(PA::$login_uid)) {
         PA::$login_uid = @$_SESSION['user']['id'];
     }
     if (PA::$login_uid) {
         $this->message_count = Message::get_new_msg_count(PA::$login_uid);
     }
     if (!isset($dynamic_page)) {
         $dynamic_page = new DynamicPage($this->page_id);
         if (!is_object($dynamic_page) or !$dynamic_page->docLoaded) {
             throw new Exception("Page XML config file for page ID: {$page_id} - not found!");
         }
         $dynamic_page->initialize();
     }
     if (false !== strpos($dynamic_page->page_type, 'group') && (!empty($_REQUEST['gid']) || !empty($_REQUEST['ccid']))) {
         // page is a group page - get group module settings
         $_gr_id = !empty($_REQUEST['gid']) ? $_REQUEST['gid'] : $_REQUEST['ccid'];
         $this->setting_data = ModuleSetting::load_setting($this->page_id, $_gr_id, 'group');
         $this->page_template = $this->setting_data['page_template'];
         if (empty($this->setting_data['access_permission'])) {
             // no permissions required to access page
             $access_permission = true;
         } else {
             $access_permission = PermissionsHandler::can_group_user(PA::$login_uid, $_gr_id, array('permissions' => $this->setting_data['access_permission']));
         }
     } else {
         if (false !== strpos($dynamic_page->page_type, 'user') && !empty(PA::$login_uid)) {
             // page is an user page - get user module settings
             //          echo "POSTING TO USER PAGE"; die();
             $this->setting_data = ModuleSetting::load_setting($this->page_id, PA::$login_uid, 'user');
             $this->page_template = $this->setting_data['page_template'];
             if (empty($this->setting_data['access_permission'])) {
                 // no permissions required to access page
                 $access_permission = true;
             } else {
                 $access_permission = PermissionsHandler::can_user(PA::$login_uid, array('permissions' => $this->setting_data['access_permission']));
             }
         } else {
             // page is a network page - get network module settings
             $this->setting_data = ModuleSetting::load_setting($this->page_id, PA::$network_info->network_id, 'network');
             $this->page_template = $this->setting_data['page_template'];
             if (empty($this->setting_data['access_permission'])) {
                 // no permissions required to access page
                 $access_permission = true;
             } else {
                 $access_permission = PermissionsHandler::can_network_user(PA::$login_uid, PA::$network_info->network_id, array('permissions' => $this->setting_data['access_permission']));
             }
         }
     }
     $this->page = new Template(CURRENT_THEME_FSPATH . "/" . $this->page_template);
     $this->page->set('current_theme_path', PA::$theme_url);
     $this->page->set('current_theme_rel_path', PA::$theme_rel);
     // Loading the templates variables for the Outer templates files
     $this->page->set('outer_class', get_class_name(PA::$config->page_type));
     $this->top_navigation_bar = new Template(CURRENT_THEME_FSPATH . "/" . $this->top_navigation_template);
     $this->top_navigation_bar->set('current_theme_path', PA::$theme_url);
     $this->top_navigation_bar->set('current_theme_rel_path', PA::$theme_rel);
     $this->top_navigation_bar->set('navigation_links', $this->navigation_links);
     $this->setHeader($this->header_template);
     $this->footer = new Template(CURRENT_THEME_FSPATH . "/footer.tpl");
     $this->footer->set('current_theme_path', PA::$theme_url);
     $this->footer->set('page_name', $title);
     $page = $this;
     $this->preInitialize($this->setting_data);
     $this->initNew($cb, $default_mode, $default_block_type, $this->setting_data);
     if (!$access_permission) {
         $configure = unserialize(ModuleData::get('configure'));
         if (PA::logged_in()) {
             $redir_url = PA::$url . PA_ROUTE_USER_PRIVATE;
         } else {
             if (!isset($configure['show_splash_page']) || $configure['show_splash_page'] == INACTIVE) {
                 $redir_url = PA::$url . '/' . FILE_LOGIN;
             } else {
                 $redir_url = PA::$url;
             }
         }
         $er_msg = urlencode("Sorry! you are not authorized to to access this page.");
         $this->showDialog($er_msg, $type = 'error', $redir_url, 10);
     }
     if (PA::$profiler) {
         PA::$profiler->stopTimer('PageRenderer_init');
     }
 }
Exemple #13
0
 /**
  * Save new module.
  * 
  * @todo Set module position.
  *
  * @param PageRevision $pageRevision
  * @param array $values
  * @return PageModule
  */
 public static function saveNewModule(PageRevision $pageRevision, array $values)
 {
     $pageModule = new PageModule();
     $pageModule->setUid(Helper::getUniqueId());
     $pageModule->setPageId($pageRevision->getPageId());
     if (ctype_digit($values['module_class'])) {
         $module = ModuleQuery::create()->findPk($values['module_class']);
         $pageModule->setModuleClass($module->getModuleClass());
         $pageModule->setName($values['name']);
         $pageModule->setTarget($values['target']);
         $pageModule->setContentVisibility($module->getContentVisibility());
         $pageModule->setSearchVisibility($module->getSearchVisibility());
         $template = $module->getTemplate();
     } else {
         $template = null;
         if ($values['template'] == 'new' && $values['template_name']) {
             $className = $values['module_class'];
             $predefinedTemplates = call_user_func(array($className, 'getPredefinedTemplates'));
             $root = \Curry\App::getInstance()['template.root'];
             $template = $values['template_name'];
             $templateFile = $root . DIRECTORY_SEPARATOR . $template;
             if (!file_exists($templateFile)) {
                 $dir = dirname($templateFile);
                 if (!is_dir($dir)) {
                     mkdir($dir, 0777, true);
                 }
                 $code = $predefinedTemplates[$values['predefined_template']];
                 file_put_contents($templateFile, (string) $code);
             }
         } else {
             if ($values['template']) {
                 $template = $values['template'];
             }
         }
         $target = '';
         if (!empty($values['target'])) {
             $target = $values['target'];
         } else {
             if (!empty($values['target_name'])) {
                 $target = $values['target_name'];
             }
         }
         if (empty($target)) {
             throw new Exception('Module target not set');
         }
         $pageModule = new PageModule();
         $pageModule->setUid(Helper::getUniqueId());
         $pageModule->setPageId($pageRevision->getPageId());
         $pageModule->setModuleClass($values['module_class']);
         $pageModule->setName($values['name']);
         $pageModule->setTarget($target);
         $pageModule->setContentVisibility($values['content_visibility']);
         $pageModule->setSearchVisibility($values['search_visibility']);
     }
     $pageModule->save();
     $revisionModule = new RevisionModule();
     $revisionModule->setPageModule($pageModule);
     $revisionModule->setPageRevision($pageRevision);
     $revisionModule->save();
     $moduleData = new ModuleData();
     $moduleData->setPageRevision($pageRevision);
     $moduleData->setPageModule($pageModule);
     $moduleData->setEnabled(true);
     $moduleData->setTemplate($template);
     $moduleData->save();
     // create default data
     $wrapper = new PageModuleWrapper($pageModule, $pageRevision, null);
     $wrapper->createData();
     return $pageModule;
 }