public function search($entityName = null, $keywords)
 {
     if (isset($keywords)) {
         $results = "";
         if (isset($entityName) && isset($this->searchingEntities[$entityName])) {
             $search_conditions = array();
             $entity = $this->searchingEntities[$entityName];
             foreach ($keywords as $kwKey => $keyword) {
                 $search_conditions[] = $keyword;
             }
             if ($entity->search($search_conditions)) {
                 $this->resultsNumber += sizeof($entity->instances);
                 $skin = new Skinlet("search/{$entity->entityName}_search");
                 $skin->setContent("instances", $entity->instances);
                 $skin->setContent("script_link", $entity->getTextSearchScript());
                 $results .= $skin->get();
             }
         } else {
             foreach ($this->searchingEntities as $k => $entity) {
                 $search_conditions = array();
                 foreach ($keywords as $kwKey => $keyword) {
                     $search_conditions[] = $keyword;
                 }
                 if ($entity->search($search_conditions)) {
                     $this->resultsNumber += sizeof($entity->instances);
                     $skin = new Skinlet("search/{$entity->entityName}_search");
                     $skin->setContent("instances", $entity->instances);
                     $skin->setContent("script_link", $entity->getTextSearchScript());
                     $results .= $skin->get();
                 }
             }
         }
     }
     return $results;
 }
 /**
  * @access public
  * @param v
  * @param preload
  * @ParamType v
  * @ParamType preload
  */
 public function build($preload)
 {
     /**
      * retrieving the field that has the same name of the graphic element that we're creating
      */
     $field_to_modify = $this->form->entity->getField($v->name);
     if ($this->mandatory != MANDATORY) {
         /**
          * if this field isn't mandatory, create an empty option
          */
         $content .= "<option value=\"\" >  </option>\n";
     }
     /**
      * retrieve the instances that has to be inserted in select options
      */
     if ($this->entity->retrieveAndLink()) {
         foreach ($this->entity->instances as $instanceKey => $instance) {
             /**
              * not selected (default)
              */
             $selected = "";
             /**
              * Preload check, if the entity of the main form was loaded and preload was requested
              */
             if ($this->form->entity->loaded && $preload) {
                 /**
                  * if the entity of the main form has a field with this widget name
                  */
                 if ($this->form->entity->existsField($this->name)) {
                     /**
                      * if the field value of the retrieved instance of the main form entity is the same of the key of the actual instance we're considering
                      * for this option
                      */
                     if ($this->form->entity->instances[0]->getFieldValue($this->name) == $instance->getKeyFieldValue()) {
                         /**
                          * mark it as selected
                          */
                         $selected = "SELECTED";
                     }
                 }
             }
             /**
              *retrieve the presentation for the entity we're considering
              */
             $presentation = $this->entity->getPresentation();
             $presentation = explode(", ", $presentation['fields']);
             $text = "";
             foreach ($presentation as $a => $v) {
                 $text .= " " . $instance->getFieldValue($v);
             }
             $content .= "<option value=\"{$instance->getKeyFieldValue()}\" {$selected} > {$text} </option>\n";
         }
     }
     $selectSkinlet = new Skinlet("widget/SelectFromReference");
     $selectSkinlet->setContent("options", $content);
     $selectSkinlet->setContent("label", $this->label);
     $selectSkinlet->setContent("name", $this->name);
     return $selectSkinlet->get();
 }
 public function draw()
 {
     $main = new Skin("installer");
     $head = new Skinlet("frame-public-head");
     $main->setContent("head", $head->get());
     $header = new Skinlet("header");
     $main->setContent("header", $header->get());
     $body = new Skinlet("installer_databaseform");
     $main->setContent("body", $body->get());
     $footer = new Skinlet("footer");
     $main->setContent("footer", $footer->get());
     $main->close();
 }
 function addItem_postInsertion()
 {
     /* controllare reload */
     $skin = new Skin("nevia");
     $mail = new Skinlet("user.mail");
     $mail->setContent("name", $_REQUEST['name']);
     $mail->setContent("username", $_REQUEST['username']);
     $mail->setContent("password", $_REQUEST['password']);
     $mail->setContent("message", $_REQUEST['message']);
     $mail->setContent("email", $_REQUEST['email']);
     if (isset($_REQUEST['home'])) {
         $mail->setContent("home", "http://www.di.univaq.it/home.php?username={$_REQUEST['username']}");
         /*	$GLOBALS['homeEntity']->insertItem(NULL, 
         											  "{$_REQUEST['username']}",
         											  date('YmdHi'), 
         											  date('YmdHi'),
         											  "Generale", 
         											  "General",
         											  "Home",
         											  "Home",
         											  "Pagina provvisoria di {$_REQUEST['name']} {$_REQUEST['surname']}", 
         											  "Temporary page of {$_REQUEST['name']} {$_REQUEST['surname']}", 
         											  "*", 
         											  1); 
         											  
         											  
         
         		*/
     }
     #aux::mail($_REQUEST['email'],"{$GLOBALS['config']['website']['name']} Login data", $mail->get(), $GLOBALS['config']['website']['email']);
     $from = 'From: no-reply@learnpad.eu' . "\r\n" . 'Reply-To: no-reply@learnpad.eu' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
     mail($_REQUEST['email'], "Learn PAd - Login data", $mail->get(), $from);
 }
 function addItem_postInsertion()
 {
     /* controllare reload */
     $skin = new Skin("dipartimento");
     $mail = new Skinlet("user.mail");
     $mail->setContent("name", $_REQUEST['name']);
     $mail->setContent("username", $_REQUEST['username']);
     $mail->setContent("password", $_REQUEST['password']);
     $mail->setContent("message", $_REQUEST['message']);
     $mail->setContent("email", $_REQUEST['email']);
     if (isset($_REQUEST['home'])) {
         $mail->setContent("home", "http://www.di.univaq.it/home.php?username={$_REQUEST['username']}");
         /*	$GLOBALS['homeEntity']->insertItem(NULL, 
         											  "{$_REQUEST['username']}",
         											  date('YmdHi'), 
         											  date('YmdHi'),
         											  "Generale", 
         											  "General",
         											  "Home",
         											  "Home",
         											  "Pagina provvisoria di {$_REQUEST['name']} {$_REQUEST['surname']}", 
         											  "Temporary page of {$_REQUEST['name']} {$_REQUEST['surname']}", 
         											  "*", 
         											  1); 
         											  
         											  
         
         		*/
     }
     /* --- The following line has been uncommented by Gulyx --- */
     aux::mail($_REQUEST['email'], "{$GLOBALS['config']['website']['name']} Login data", $mail->get(), $GLOBALS['config']['website']['email']);
 }
Exemple #6
0
 /**
  * This method is used to list all the occurrences of an entity in the back end according to the query_restrictions requested
  * It uses the specific entity_name-report.html autogenerated or modified from the user
  * @param boolean $noDelete
  * @param integer $page
  * @return string
  */
 function report($noDelete = false, $page = 0)
 {
     $entityTemplate = new Skinlet($this->reportTemplate);
     $entityTemplate->setContent("service_link", basename($_SERVER["SCRIPT_NAME"]));
     $entityReport = $this->reportContent;
     $entityReport->apply($entityTemplate);
     $reportAsString = $entityTemplate->get();
     if (!empty($reportAsString)) {
         $content = $reportAsString;
     } else {
         $emptyReportTemplate = new Skinlet("empty-report");
         $content = '<div>' . $emptyReportTemplate->get() . '</div>';
     }
     return $content;
 }
 public function updateOutput()
 {
     if ($this->validData) {
         header('Location: install_complete.php');
     } else {
         $main = new Skin("installer");
         $head = new Skinlet("frame-public-head");
         $main->setContent("head", $head->get());
         $header = new Skinlet("header");
         $main->setContent("header", $header->get());
         $body = new Skinlet("installer_template");
         $main->setContent("body", $body->get());
         $footer = new Skinlet("footer");
         $main->setContent("footer", $footer->get());
         $main->close();
     }
 }
 /**
  * @access public
  * @param v
  * @param preload
  * @ParamType v 
  * @ParamType preload 
  */
 public function build($preload)
 {
     /**
      * retrieving the field that has the same name of the graphic element that we're creating
      */
     $field_to_modify = $this->form->entity->getField($this->name);
     if ($preload && $this->form->entity->loaded) {
         $dateObj = new DateTime($this->form->entity->instances[0]->getFieldValue($this->name));
         $date = $dateObj->format("d/m/Y");
         $time = $dateObj->format("H:i");
     } else {
         if ($this->mandatory == MANDATORY) {
             $date = date("d/m/Y");
             $time = date("H:i");
         } else {
             $date = "";
             $time = "";
         }
     }
     $widgetSkinlet = new Skinlet("widget/LongDate");
     $widgetSkinlet->setContent("widget", $content);
     $widgetSkinlet->setContent("label", $this->label);
     $widgetSkinlet->setContent("name", $this->name);
     $widgetSkinlet->setContent("date", $date);
     $widgetSkinlet->setContent("time", $time);
     //$widgetSkinlet->setContent("disabled", $disabled);
     return $widgetSkinlet->get();
 }
 public function updateOutput()
 {
     if ($this->validData) {
         header('location: install_complete.php');
     } else {
         $main = new Skin("system");
         $head = new Skinlet("frame-private-head");
         $main->setContent("head", $head->get());
         $header = new Skinlet("header");
         $header->setContent("webApp", 'Installing');
         $main->setContent("header", $header->get());
         $body = new Skinlet("installer_admin");
         $main->setContent("body", $body->get());
         $menu = new Skinlet("menu_installer");
         $footer = new Skinlet("footer");
         $menu->setContent('footer', $footer->get());
         $main->setContent("menu", $menu->get());
         $main->close();
     }
 }
 public function updateOutput()
 {
     $main = new Skin("system");
     $head = new Skinlet("frame-private-head");
     $main->setContent("head", $head->get());
     $header = new Skinlet("header");
     $header->setContent('webApp', 'Installing');
     $main->setContent("header", $header->get());
     $menu = new Skinlet('menu_installer');
     $footer = new Skinlet("footer");
     $menu->setContent("footer", $footer->get());
     $main->setContent('menu', $menu->get());
     if ($this->validData) {
         $body = new Skinlet("installer_databaseform");
     } else {
         $body = new Skinlet("installer_init");
     }
     $main->setContent("body", $body->get());
     $main->close();
 }
 /**
  * @access public
  * @param v
  * @param preload
  * @ParamType v
  * @ParamType preload
  */
 public function build($preload)
 {
     if ($this->form->entity->loaded && $preload) {
         $preloadedParentId = $this->form->entity->instances[0]->getFieldValue($this->name);
         $editingId = $this->form->entity->instances[0]->getKeyFieldValue();
     } else {
         $editingId = 0;
     }
     /**
      * finding presentation fields of this entity
      */
     $presentation = $this->form->entity->getPresentation();
     $presentation = explode(", ", $presentation['fields']);
     /**
      * inserting an empty field in order to offer null attribute
      */
     if ($this->mandatory != MANDATORY) {
         $parents .= "<option value=\"\"> Nessun padre</option>";
     }
     /**
      * retrieving other instances of the same entity in order to retrieve a list of other positions
      */
     if ($this->entity->retrieveOnly()) {
         foreach ($this->entity->instances as $instanceKey => $instance) {
             $key = md5(microtime()) . "_" . $this->form->formHash;
             $text = "";
             foreach ($presentation as $a => $v) {
                 $text = $instance->getFieldValue($v);
             }
             if ($preloadedParentId == $instance->getKeyFieldValue()) {
                 $selected = "SELECTED";
             } else {
                 $selected = "";
             }
             $parents .= "<option value=\"{$instance->getKeyFieldValue()}\" {$selected}>{$text}</option>";
         }
     }
     $positionSkinlet = new Skinlet("widget/HierarchicalPosition");
     $positionSkinlet->setContent("label", $this->label);
     $positionSkinlet->setContent("editing_id", $editingId);
     $positionSkinlet->setContent("entity_name", $this->form->entity->name);
     $positionSkinlet->setContent("parent_name", $this->name);
     $positionSkinlet->setContent("parents_list", $parents);
     $positionSkinlet->setContent("form_hash", $this->form->formHash);
     return $positionSkinlet->get();
 }
Exemple #12
0
 /**
  *
  * (non-PHPdoc)
  * @see FormWidget::build()
  * @access public
  * @param v
  * @param preload
  * @param entity
  * @ParamType v
  * @ParamType preload
  * @ParamType entity
  */
 public function build($preload)
 {
     $mandatory = "";
     /**
      * Mandatory text
      */
     if ($this->mandatory == MANDATORY) {
         $mandatory = 'required';
     }
     if ($this->mainEntry == true) {
         $id = "mainEntry";
     } else {
         $id = $this->name;
     }
     /**
      * Max length of text
      */
     if ($this->maxlength != null) {
         $maxLength = 'maxlength="' . $this->maxlength . '"';
     } else {
         $maxLength = "";
     }
     /**
      * See definition of $loaded attribute in entity.inc.php, it defines if data was correctly retrieved from db
      * Deprecating the use of everywhere queries, limit use to Entity class in order to add multi-dbms support
      */
     $value = "";
     if ($preload && $this->form->entity->loaded == true) {
         $field_to_modify = $this->form->entity->instances[0]->getFieldValue($this->name);
         if ($this->form->entity->addslashes && isset($field_to_modify)) {
             $value = stripslashes($field_to_modify);
         } else {
             $value = $field_to_modify;
         }
     }
     $widget = new Skinlet("widget/TextField");
     $widget->setContent("label", $this->label);
     $widget->setContent("name", $this->name);
     $widget->setContent("mandatory", $mandatory);
     $widget->setContent("type", $this->type);
     $widget->setContent("value", $value);
     $widget->setContent("id", $id);
     return $widget->get();
 }
 function addItem_postInsertion()
 {
     /* controllare reload */
     $skin = new Skin("handling");
     $mail = new Skinlet("user.mail");
     $mail->setContent("name", $_REQUEST['name']);
     $mail->setContent("username", $_REQUEST['username']);
     $mail->setContent("password", $_REQUEST['password']);
     $mail->setContent("message", $_REQUEST['message']);
     $mail->setContent("email", $_REQUEST['email']);
     if (isset($GLOBALS['homeEntity'])) {
         if (isset($_REQUEST['home'])) {
             $mail->setContent("home", "http://www.di.univaq.it/home.php?username={$_REQUEST['username']}");
             $GLOBALS['homeEntity']->insertItem(NULL, "{$_REQUEST['username']}", date('YmdHi'), date('YmdHi'), "Generale", "General", "Home", "Home", "Pagina provvisoria di {$_REQUEST['name']} {$_REQUEST['surname']}", "Temporary page of {$_REQUEST['name']} {$_REQUEST['surname']}", "*", 1);
         }
         $config = Config::getInstance()->getConfigurations();
         Parser::mail($_REQUEST['email'], "{$config['website']['name']} Login data", $mail->get(), $config['website']['email']);
     }
 }
 /**
  * @access public
  * @param v
  * @param preload
  * @ParamType v
  * @ParamType preload
  */
 public function build($preload)
 {
     /**
      * retrieving the field that has the same name of the graphic element that we're creating
      */
     $value = "";
     if ($this->form->entity->loaded && $preload) {
         $entityInstance = $this->form->entity->instances[0];
         $value = $entityInstance->getFieldValue($this->name);
     }
     $widget = new Skinlet("widget/EditorField");
     $widget->setContent("label", $this->label);
     $widget->setContent("name", $this->name);
     $widget->setContent("rows", $this->rows);
     $widget->setContent("cols", $this->cols);
     $widget->setContent("value", $value);
     return $widget->get();
 }
 /**
  * @access public
  * @param preload
  * @ParamType string
  */
 public function build($preload)
 {
     $value = "";
     $preloadedId = 0;
     if ($this->form->entity->loaded && $preload == PRELOAD) {
         $entityInstance = $this->form->entity->instances[0];
         $preloadedId = $entityInstance->getFieldValue($this->name);
         if (Settings::getOperativeMode() == 'debug') {
             echo '<br />ImageField debugmode';
             var_dump($preloadedId);
         }
     }
     $key = $this->form->formHash;
     $widget = new Skinlet("widget/ImageField");
     $widget->setContent("label", $this->label);
     $widget->setContent("name", $key . '_' . $this->name);
     $widget->setContent("formHash", $key);
     $widget->setContent("loggedUsername", $_SESSION["user"]["username"]);
     $widget->setContent("preloadedImageId", $preloadedId);
     return $widget->get();
 }
 /**
  * @access public
  * @param v
  * @param preload
  * @ParamType v
  * @ParamType preload
  */
 public function build($preload)
 {
     // 		$content="";
     // 		if (isset($this->form->helpers[$this->name])) {
     // 			$content .= "    <td>{$this->label} <a href=# title=\"{$this->form->helpers[$this->name]}\"><img src=\"img/form/help.gif\"  class=\"helper\"></a> </td>\n";
     // 		} else {
     // 			//$content .= "<label class=\"cells\">{$this->label}</label>\n";
     // 		}
     // 		if ($this->maxlength) {
     // 			$content .= " <input class=\"cells mb20\" type=\"{$this->type}\" name=\"{$this->name}\" size=\"{$this->size}\">\n";
     // 		} else {
     // 			$content .= " <input class=\"cells mb20\" type=\"{$this->type}\" name=\"{$this->name}\" size=\"{$this->size}\" maxlength=\"{$this->maxlength}\">\n";
     // 		}
     $widget = new Skinlet("widget/PasswordField");
     $widget->setContent("label", $this->label);
     $widget->setContent("name", $this->name);
     $widget->setContent("maxlength", $this->maxlength);
     $widget->setContent("type", $this->type);
     $widget->setContent("size", $this->size);
     return $widget->get();
 }
    /**
     * @access public
     * @param v
     * @param preload
     * @ParamType v 
     * @ParamType preload 
     */
    public function build($preload)
    {
        if ($this->form->entity->loaded && preload) {
            $entityId = $this->form->entity->instances[0]->getFieldValue($this->name);
        }
        /**
         * finding presentation fields of this entity
         */
        $presentation = $this->form->entity->getPresentation();
        $presentation = explode(", ", $presentation['fields']);
        /**
         * retrieving other instances of the same entity in order to retrieve a list of other positions
         */
        if ($this->form->entity->retrieveOnly()) {
            foreach ($this->form->entity->instances as $instanceKey => $instance) {
                $key = md5(microtime()) . "_" . $this->form->formHash;
                $text = "";
                foreach ($presentation as $a => $v) {
                    $text = $instance->getFieldValue($v);
                }
                $content .= '<div class="child-item">
				            <span>' . $text . '</span>
				            <input type="hidden" id="' . $this->name . '_' . $key . '" name="' . $this->name . '_' . $key . '" value="' . $instance->getFieldValue($this->name) . '" >  </input>
				            </div>';
                $hiddenIds .= '<input type="hidden" name="' . $this->form->entity->name . '_' . $this->form->entity->fields[0]->name . '_' . $key . '" value="' . $instance->getFieldValue($this->name) . '"></input>';
            }
            if (!$this->form->entity->loaded || !$preload) {
                $newPosition = sizeof($this->form->entity->instances) + 1;
                $content .= '<div class="editing-item"> <span id="editing-item-name">Nuovo Valore</span> <input type="hidden" name="' . $this->name . '" value="' . $newPosition . '" />';
            }
            $positionSkinlet = new Skinlet("widget/Position");
            $positionSkinlet->setContent("label", $this->label);
            $positionSkinlet->setContent("AttributeName", $this->name);
            $positionSkinlet->setContent("AttributeValue", $entityId);
            $positionSkinlet->setContent("instances", $content);
            $positionSkinlet->setContent("ids", $hiddenIds);
            return $positionSkinlet->get();
        }
    }
Exemple #18
0
 /**
  * @access public
  * @param v
  * @param preload
  * @ParamType v 
  * @ParamType preload 
  */
 public function build($preload)
 {
     $field_to_modify = $this->form->entity->getField($this->name);
     if ($preload && $this->form->entity->loaded) {
         $dateObj = new DateTime($this->form->entity->instances[0]->getFieldValue($this->name));
         $date = $dateObj->format("d/m/Y");
     } else {
         if ($this->mandatory == MANDATORY) {
             $date = date("d/m/Y");
         } else {
             $date = "";
         }
     }
     $widgetSkinlet = new Skinlet("widget/Date");
     $widgetSkinlet->setContent("widget", $content);
     $widgetSkinlet->setContent("label", $this->label);
     $widgetSkinlet->setContent("name", $this->name);
     $widgetSkinlet->setContent("date", $date);
     //$widgetSkinlet->setContent("disabled", $disabled);
     return $widgetSkinlet->get();
 }
 /**
  *
  * @param Skin $skin
  * @param boolean $login
  * Costruisce la struttura del back-end.
  * Utilizza:
  * frame-private-head: tag html <head>
  * header e footer: header e footer del tema
  *
  */
 public function createSystemGraphic($skin, $login = false)
 {
     /*
      * entity necessarie per il funzionamento del back-end
      */
     $actualUser = $_SESSION['user']['username'];
     $servicecategoryEntity = $GLOBALS['sys_servicecategory'];
     $servicesEntity = $GLOBALS['sys_service'];
     $servicesGroupsRelation = $GLOBALS['sys_service_sys_group'];
     $groupsEntity = $GLOBALS['sys_group'];
     $userEntity = $GLOBALS['sys_user'];
     $usersGroupsRelation = $GLOBALS['sys_user_sys_group'];
     /*
      * skinlet frame-private-head: skins/system/frame-private-head.html
      */
     $head = new Skinlet("frame-private-head");
     /*
      * skinlet header: skins/system/header.html
      */
     $header = new Skinlet("header");
     $loggedUser = new Content($userEntity);
     $loggedUser->setFilter('username', $actualUser);
     $loggedUser->forceSingle();
     $loggedUser->apply($header);
     $config = Config::getInstance()->getConfigurations();
     $header->setContent('webApp', $config["defaultuser"]["webApp"]);
     /*
      * skinlet menu_admin: skins/system/menu_admin.html
      */
     $menuTemplate = new Skinlet("menu_admin");
     $menu = new Content($servicecategoryEntity, $servicesEntity, $servicesGroupsRelation, $groupsEntity, $usersGroupsRelation);
     $menu->setOrderFields("position");
     $menu->setFilter("username_sys_user", $actualUser);
     $menu->apply($menuTemplate);
     /*
      * skinlet footer: skins/system/footer.html
      */
     $footer = new Skinlet("footer");
     $menuTemplate->setContent("footer", $footer->get());
     /*
      * funzionalità breadcrump
      */
     /*
         $breadcrump = new Skinlet("sitemap");
         $breadcrumpContent = new Content($pageEntity, $pageEntity, $pageEntity);
         $breadcrumpContent->forceMultiple();
         $breadcrumpContent->apply($breadcrump);
     
         $actual_script=str_replace("/", "", $_SERVER['SCRIPT_NAME']);
     
         if($actual_script!="page.php")
             $breadcrump->setContent('actual_script', $actual_script);
         else
             $breadcrump->setContent('actual_script',str_replace("/", "", $_SERVER['REQUEST_URI']) );
     
         $skin->setContent("sitemap", $breadcrump->get());
     */
     /*
      * creazione della struttura
      */
     $skin->setContent("head", $head->get());
     $skin->setContent("header", $header->get());
     $skin->setContent("menu", $menuTemplate->get());
 }
Exemple #20
0
<?php

session_start();
session_destroy();
session_start();
require "include/beContent.inc.php";
require_once "include/content.inc.php";
require "include/auth.inc.php";
require_once realpath(dirname(__FILE__)) . '/include/view/template/InitGraphic.php';
$main = new Skin('system');
InitGraphic::getInstance()->createSystemGraphic($main);
$loginBody = new Skinlet('login');
$main->setContent('body', $loginBody->get());
$main->close();
 /**
  * @access public
  * @param preload
  * @ParamType preload  string
  */
 public function build($preload)
 {
     $content = "";
     switch ($this->orientation) {
         case RIGHT:
             $mainEntity = $this->form->entity->entity_1;
             $secondaryEntity = $this->form->entity->entity_2;
             $mainEntityRoleName = $this->form->entity->roleName1;
             $secondaryEntityRoleName = $this->form->entity->roleName2;
             break;
         case LEFT:
             $mainEntity = $this->form->entity->entity_2;
             $secondaryEntity = $this->form->entity->entity_1;
             $mainEntityRoleName = $this->form->entity->roleName2;
             $secondaryEntityRoleName = $this->form->entity->roleName1;
             break;
     }
     if (Settings::getOperativeMode() == 'debug') {
         echo '<br />Relation Manager Field';
         echo ' entity_1';
         var_dump($mainEntity->name);
         echo ' entity_2';
         var_dump($secondaryEntity->name);
         echo '<br />Orientation';
         echo $this->orientation;
     }
     $relAttributes = $this->form->entity->fields;
     /**
      * Retrieving all instances for this entity
      * (Observation, at this point a query filter as to be added)
      */
     $secondaryEntity->retrieveAndLink();
     if ($preload == PRELOAD && $mainEntity->loaded) {
         $where_conditions = array($mainEntity->fields[0]->name . "_" . $mainEntity->name => $mainEntity->instances[0]->getKeyFieldValue());
         $this->form->entity->retrieveAndLink($where_conditions);
     }
     foreach ($secondaryEntity->instances as $k => $instance) {
         $presentation = $secondaryEntity->getPresentation();
         $presentation = explode(", ", $presentation['fields']);
         $text = "";
         foreach ($presentation as $a => $v) {
             $text = $instance->getFieldValue($v);
         }
         $key = md5(microtime()) . "_" . $this->form->formHash;
         $name = "{$secondaryEntity->fields[0]->name}_{$secondaryEntity->name}_" . $key;
         $relationExists = false;
         $checked = "";
         $foundRelation = null;
         if ($preload == PRELOAD) {
             foreach ($this->form->entity->instances as $relationInstanceKey => $relationInstance) {
                 if ($relationInstance->getFieldValue($secondaryEntityRoleName) == $instance->getKeyFieldValue() && $relationInstance->getFieldValue($mainEntityRoleName) == $mainEntity->instances[0]->getKeyFieldValue()) {
                     $relationExists = true;
                     $foundRelation = $relationInstance;
                     $checked = 'checked';
                 }
             }
         }
         $content .= '<!--relation manager fields -->';
         $content .= '<fieldset class="items">';
         $content .= '<div id="ck-button">';
         $content .= '<label>';
         $content .= '<input class="" id="' . $name . '" type="checkbox" name="' . $name . '" value="' . $instance->getKeyFieldValue() . '"  ' . $checked . ' />';
         $content .= '<span>' . $text . '</span>';
         $content .= '</label>';
         $content .= '</div>';
         $content .= '<div class="clear">&nbsp;</div>';
         // 			$content .= '<input class="mb20 h23 no_mt" id=" '. $name.' " type="checkbox" name=" '.$name.'" value="'.$instance->getKeyFieldValue().'"checked="'.$checked.'" />';
         // 			$content .= '<label class="flt_lft line_height23 w150 right_align mr20" for="'.$name.'">'.$text.'</label>';
         // 			$content .= '<div class="clear">&nbsp;</div>';
         for ($i = 3; $i < sizeof($this->form->entity->fields); $i++) {
             $value = "";
             if ($relationExists) {
                 $value = $foundRelation->getFieldValue($this->form->entity->fields[$i]->name);
             }
             $content .= '<div class="">';
             $content .= '<label class="">' . $this->form->attributesNames[$relAttributes[$i]->name] . '</label>';
             $content .= '<input class=""  type="text" name="' . $relAttributes[$i]->name . '_' . $key . '" value="' . $value . '" />';
             $content .= '</div>';
             $content .= '<div class="clear">&nbsp;</div>';
         }
         $content .= '</fieldset>';
     }
     $relationManagerSkinlet = new Skinlet("widget/RelationManager");
     $relationManagerSkinlet->setContent("label", $this->label);
     $relationManagerSkinlet->setContent("instances", $content);
     return $relationManagerSkinlet->get();
 }
Exemple #22
0
<?php

session_start();
require "include/template2.inc.php";
require "include/beContent.inc.php";
require "include/content.inc.php";
if (!$_SESSION['username']) {
    $main = new Skin("nevia");
} else {
    $main = new Skin("loggato");
}
$best = new Skinlet("best");
$rece = new Skinlet("rec");
$slides = new Skinlet("slide-multiple");
$last = new Skinlet("lastminute");
$recensioni = new Content($recensioniEntity);
$recensioni->setOrderFields("id DESC");
$recensioni->setLimit(3);
$recensioni->apply($rece);
$recensioni->applyIndexed($rece);
$main->setContent('recensioni', $rece->get());
$slide = new Content($slideEntity);
$slide->apply($slides);
$main->setContent("slide", $slides->get());
$lastminute = new Content($eventiEntity);
$lastminute->setOrderFields("id DESC");
$lastminute->setLimit(3);
$lastminute->apply($last);
$main->setContent("lastminute", $last->get());
$main->setContent("best", $best->get());
$main->close();
Exemple #23
0
<?php

session_start();
require "include/template2.inc.php";
require "include/beContent.inc.php";
require "include/content.inc.php";
require "include/puma/pumaDigitalLibrary.php";
if (!$_SESSION['username']) {
    $main = new Skin("nevia");
} else {
    $main = new Skin("loggato");
}
$body = new Skinlet("pubs");
/* fetch json encoded publication from the puma system */
$puma = new PumaDigitalLibrary();
//$result = $puma->getPublicationsByAuthorJSON("polini", "andrea");
$result = $puma->getPublicationsByTypeJSON();
$result = json_decode($result);
foreach ($result as $type => $row) {
    /*if ($type == "Journal articles") {
    		$type = "Publications";
    	}*/
    $body->setContent("type", $type);
    foreach ($row as $year => $row) {
        $body->setContent("year", $year);
        foreach ($row as $row) {
            foreach ($row as $name => $value) {
                /*if ($name == "link") {
                        			foreach ($value as $name => $value2) {
                        				echo "-> $name: {$value[$name]}<br>";
                        			}
Exemple #24
0
<?php

session_start();
require "include/template2.inc.php";
require "include/beContent.inc.php";
require "include/content.inc.php";
$main = new Skin("orange");
if (!isset($_GET['id'])) {
    $data = aux::getResult("SELECT id,title,description FROM {$channelEntity->name}");
    $body = new Skinlet("rss.html");
    $body->setContent("website", $GLOBALS['config']['website']['name']);
    $body->setContent("item", $data);
    $main->setContent("body", $body->get());
    $main->close();
} else {
    $rss = new FeedRss($channelEntity);
    $data = aux::getResultArray("SELECT title FROM {$channelEntity->name} WHERE id={$_GET['id']}", 'title');
    $rss->addChannel("{$data[0]}");
    $rss->emitXML();
}
 function search()
 {
     $entities = func_get_args();
     $text = $_REQUEST['text'];
     $_REQUEST['text'] = addslashes($text);
     $_REQUEST['action'] = "search";
     $_REQUEST['page'] = 1;
     $empty = true;
     $skin = new Skinlet("search");
     foreach ($entities as $entity) {
         if (is_array($entity->searchFields)) {
             $data = aux::getResult($GLOBALS['becontent']->getsearchform($entity));
             /* DEBUG */
             if (count($data) > 0) {
                 $empty = false;
                 foreach ($data as $item) {
                     $head = "";
                     if (is_array($entity->searchHead)) {
                         foreach ($entity->searchHead as $field) {
                             if (!$entity->existsField($field)) {
                                 $head .= " " . $item[$entity->name . "_" . $field . "_" . $_SESSION['language']];
                             } else {
                                 $head .= " " . $item[$entity->name . "_" . $field];
                             }
                         }
                         $skin->setContent("handler", $entity->searchHandler);
                         $skin->setContent("table", $entity->name);
                         $skin->setContent("key", $entity->fields[0]['name']);
                         $skin->setContent("value", $item["{$entity->name}_{$entity->fields[0]['name']}"]);
                         $skin->setContent("title", $head);
                     }
                     $body = "";
                     if (is_array($entity->searchBody)) {
                         foreach ($entity->searchBody as $field) {
                             if (!$entity->existsField($field)) {
                                 $body .= " " . $item[$entity->name . "_" . $field . "_" . $_SESSION['language']];
                             } else {
                                 $body .= " " . $item[$entity->name . "_" . $field];
                             }
                             $body .= "<br />";
                         }
                         $skin->setContent("body", $body);
                     }
                     if ($entity->owner) {
                         $skin->setContent("date", "</p><p class=\"search-date\">" . aux::lingual("Pubblicato", "Published on", "") . " " . aux::formatDate($item['creation'], EXTENDED));
                     } else {
                         $skin->setContent("date", "");
                     }
                 }
             }
         }
     }
     if ($empty) {
         $skin = new Skinlet("search_empty");
     }
     $skin->setContent("text", htmlspecialchars($text));
     return $skin->get();
 }
Exemple #26
0
<?php

require_once "include/skin.inc.php";
require_once 'include/skinlet.inc.php';
require_once "include/beContent.inc.php";
require_once "include/entities.inc.php";
require_once "include/content.inc.php";
require_once "include/control/search/searchEngine.php";
require_once realpath(dirname(__FILE__)) . '/include/view/template/InitGraphic.php';
$main = new Skin();
InitGraphic::getInstance()->createGraphic($main);
$homeTemplate = new Skinlet("search");
$engine = new SearchEngine();
if (isset($_POST["search"]) && $_POST["search"] != "") {
    $sintax = explode(":", $_POST["search"]);
    if (isset($sintax[1])) {
        $entityName = $sintax[0];
        $search = explode(" ", $sintax[1]);
    } else {
        $entityName = null;
        $search = explode(" ", $_POST["search"]);
    }
}
$homeTemplate->setContent("results", $engine->search($entityName, $search));
$homeTemplate->setContent("search_keywords", $_POST["search"]);
$homeTemplate->setContent("results_number", $engine->resultsNumber);
$main->setContent("body", $homeTemplate->get());
$main->close();
 /**
  * Default building search template
  *
  * @param Entity $entity
  */
 static function createTemplateSearch($entity)
 {
     $searchTemplate = new Skinlet("autotemplate");
     $templateAsString = $searchTemplate->get();
     if (!is_dir(Settings::getSkin() . '/search/')) {
         mkdir(Settings::getSkin() . '/search/', 0777);
     }
     $filename = Settings::getSkin() . "/search/" . $entity->name . "_search.html";
     if (!file_exists($filename)) {
         $templateAsString = preg_replace("~\\[(?!entity_content\\d+_\\d+).+\\]~Us", "\n<!-- MODIFICA QUESTA LINEA-->" . self::searchFieldsEntity($entity) . "\n<!-- MODIFICA QUESTA LINEA-->\n", $templateAsString);
         $handleFile = fopen($filename, "w");
         fwrite($handleFile, $templateAsString);
         fclose($handleFile);
     }
 }
Exemple #28
0
    case LOGIN_ERROR:
        $body = new Skinlet("error");
        $body->setContent("message", "Username or password unknown.");
        unset($_SESSION['user']);
        $_SESSION['HTTP_LOGIN'] = false;
        break;
    case PRIVILEDGE_ERROR:
        $body = new Skinlet("error");
        $body->setContent("message", "Warning: you are not permitted to use this service!");
        break;
    case DATAFILTERING_ERROR:
        $body = new Skinlet("error");
        $body->setContent("message", "Warning: you are not permitted to modify this item!");
        break;
    case "pageNotFound":
        $body = new Template(Settings::getSkin() . "/error.html");
        $body->setContent("message", "Warning: page not found!");
        break;
    case NOTIFICATION:
        $main = new Skin("orange");
        $body = new Skinlet("password_notification");
        break;
    case NOTIFICATION_ERROR:
        $main = new Skin("handling");
        $body = new Skinlet("password_notification_error");
        $body->setContent("ip", $_SERVER['REMOTE_ADDR']);
        break;
}
session_destroy();
$main->setContent("body", $body->get());
$main->close();
                case ',':
                    $result .= $char . $newline . str_repeat($tab, $tabcount);
                    break;
                case '"':
                    $inquote = !$inquote;
                    $result .= $char;
                    break;
                case '\\':
                    if ($inquote) {
                        $ignorenext = true;
                    }
                    $result .= $char;
                    break;
                default:
                    $result .= $char;
            }
        }
    }
    return $result;
}
foreach (beContent::getInstance()->entities as $k => $v) {
    $installation_info["installed_entities"][$v->entityName] = $v->entityName;
}
$installation_info["installation_date"] = new DateTime();
file_put_contents(realpath(dirname(__FILE__)) . '/contents/installation_info.cfg', json_encode($installation_info));
$main = new Skin("system");
InitGraphic::getInstance()->createSystemGraphic($main);
$body = new Skinlet("admin");
//$body->setContent("installation_report", _format_json(json_encode($installation_info), true));
$main->setContent("body", $body->get());
$main->close();
Exemple #30
0
 /**
  * This method is used to output template with data inside,
  * it returns the compiled html code, it uses getRaw to retrieve data
  * it assigns the standard template to entities in the schema multiple/entity_name_multiple.html
  * or single/entity_name_single.html
  * @param unknown_type $key
  * @return string
  */
 function get($key = "")
 {
     /**
      * retrieving the requested entity from database
      *
      */
     $entity = DB::getInstance()->getEntityByName($this->entity_name);
     /**
      * enabling parameters that could have been specified in the Content construction 'till now
      */
     $this->enableRequest();
     /**
      * Executing data retrieve
      */
     $data = $this->getRaw($key);
     /**
      * passing retrieved instances to smarty
      */
     if ($this->mode == SINGLE) {
         $skin = new Skinlet("single/{$entity->entityName}_single");
         if (isset($entity->instances)) {
             $skin->setContent("instance", $entity->instances[0]);
         } else {
             $skin->setContent("instance", null);
         }
         $skin->setContent("instances", null);
     } else {
         $skin = new Skinlet("multiple/{$entity->entityName}_multiple");
         if (isset($entity->instances)) {
             $skin->setContent("instances", $entity->instances);
         } else {
             $skin->setContent("instances", null);
         }
         $skin->setContent("instance", null);
     }
     if (isset($this->values)) {
         foreach ($this->values as $placeholder => $value) {
             $skin->setContent($placeholder, $value);
         }
     }
     return $skin->get();
 }