/** * @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 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(); }
/** * @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 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(); }
/** * @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 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(); }
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']); }
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); }
/** * @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(); } }
/** * 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() { $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(); }
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(); } }
/** * @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(); }
/** * * (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']); } }
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>"; } } else { echo "$name: $value <br>"; }*/ $link = $value; if ($name == "doi") { if ($value != "") {
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(); }
/** * @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"> </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"> </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"> </div>'; } $content .= '</fieldset>'; } $relationManagerSkinlet = new Skinlet("widget/RelationManager"); $relationManagerSkinlet->setContent("label", $this->label); $relationManagerSkinlet->setContent("instances", $content); return $relationManagerSkinlet->get(); }
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();
/** * 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(); }
/** * @access public * @param preload * @ParamType preload string */ 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']); $field_to_modify = $this->form->entity->getField($this->name); /** * Observation, this time the field is a file so four fields are involved in the operation, * for this reason four variables must be initialized */ $field_to_modify_type = $this->form->entity->getField($v['name'] . "_type"); $field_to_modify_filename = $this->form->entity->getField($v['name'] . "_filename"); $field_to_modify_reference = $this->form->entity->getField($v['name'] . "_reference"); if (Settings::getOperativeMode() == 'debug') { echo '<br />debug in File Field widgets '; echo '<br />field to modify '; var_dump($field_to_modify); echo '<br />field to modify type '; var_dump($field_to_modify_type); echo '<br />field to modify filename '; var_dump($field_to_modify_filename); echo '<br />field to modify reference '; var_dump($field_to_modify_reference); echo '<br />preload '; var_dump($preload); echo '<br />$v '; var_dump($v); } if ($preload) { if (isset($this->form->helpers[$v['name']])) { $content .= " <td>{$v["label"]} <a href=# title=\"{$this->form->helpers[$v['name']]}\"><img src=\"img/form/help.gif\" class=\"helper\"></a> </td>\n"; } else { $label = $v['label']; //$content .= '<label>'.$v["label"].'</label>'; } $name = $v['name']; $value = $field_to_modify_filename; //input hidden name + value //$content .= "<input class=\"inl_blks cells mb20\" type=\"file\" name=\"{$v['name']}\"/> // <input type=\"hidden\" name=\"{$v['name']}_hidden\" value=\"{$field_to_modify_filename}\" />\n"; if ($_REQUEST[$v['name']]) { switch ($field_to_modify_type) { case "image/jpeg": case "image/gif": /* IMAGE */ $content .= " <div class=\"image-show\" id=\"{$v['name']}\" >\n\n\t\t\t\t\t\t <input type=\"text\" class=\"file\" value=\"" . $field_to_modify_filename . "\" disabled />\n\t\t\t\t\t\t <img src=\"img/beContent/show-gray.jpg\" onClick=\"image_show('{$v['name']}')\">\n\t\t\t\t\t\t <div id=\"{$v['name']}_img\">"; $content .= "<span>" . $field_to_modify_type . "</span><br />\n<img class=\"left\" src=\"show.php?token=" . md5($this->form->entity->name . $v['name']) . "&id={$_REQUEST['value']}&width=188\">\n</div>\n</div>"; $content .= " <input class=\"clear\" type=\"checkbox\" name=\"{$v['name']}_delete\" value=\"*\"> " . Message::getInstance()->getMessage(MSG_FILE_DELETE); break; case "video/x-flv": case "application/octet-stream": /* FLASH VIDEO FLV The extension should be checked since anything can be uploaded here. */ $content .= " <div class=\"image-show\" id=\"{$v['name']}\" >\n<input type=\"text\" class=\"file\" value=\"" . $field_to_modify_filename . "\" disabled /><img src=\"img/beContent/show-gray.jpg\" onClick=\"image_show('{$v['name']}')\">\n<div id=\"{$v['name']}_img\">\n"; $src = "show.php?token=" . md5($this->form->entity->name . $v['name']) . "&id={$_REQUEST['value']}"; $width = 200; $height = 150; $content .= "<script type=\"text/javascript\">\nAC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0','width','{$width}','height','{$height}','id','FLVPlayer2','src','FLVPlayer_Progressive','flashvars','&MM_ComponentVersion=1&skinName=includes/flv/players/player-unov&streamName={$src}&autoPlay=false&autoRewind=false','scale','noscale','name','FLVPlayer','salign','lt','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','FLVPlayer_Progressive' );\n</script>\n<noscript>\n<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"{$width}\" height=\"{$height}\" id=\"FLVPlayer2\">\n<param name=\"movie\" value=\"FLVPlayer_Progressive.swf\" />\n<param name=\"salign\" value=\"lt\" />\n<param name=\"scale\" value=\"noscale\" />\n<param name=\"FlashVars\" value=\"&MM_ComponentVersion=1&skinName=includes/flv/players/player-unov&streamName={$src}&autoPlay=false&autoRewind=false\" />\n<embed src=\"FLVPlayer_Progressive.swf\" flashvars=\"&MM_ComponentVersion=1&skinName=includes/flv/players/player-unov&streamName={$src}&autoPlay=false&autoRewind=false\" scale=\"noscale\" width=\"{$width}\" height=\"{$height}\" name=\"FLVPlayer\" salign=\"LT\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" />\n</object>\n</noscript>\n"; $content .= "</div>\n"; break; default: /* UNKNOWN MIME TYPE */ $content .= " <div class=\"image-show\" id=\"{$v['name']}\" ><input type=\"text\" class=\"file\" value=\"" . $field_to_modify_filename . "\" disabled /><a target=\"_blank\" title=\"{$field_to_modify_filename}\" href=\"show.php?token=" . md5($this->form->entity->name . $v['name']) . "&id={$_REQUEST['value']}\"><img src=\"img/beContent/show-gray-link.jpg\"></a></div>"; $content .= "<input class=\"clear\" type=\"checkbox\" name=\"{$v['name']}_delete\" value=\"*\"> " . Message::getInstance()->getMessage(MSG_FILE_DELETE); break; } $content .= "\n"; } else { /* EMPTY */ $content .= " <div class=\"image-show\" ><input type=\"text\" class=\"file\" value=\"" . Message::getInstance()->getMessage(MSG_FILE_NONE) . "\" disabled /><img src=\"img/beContent/show-gray-disabled.jpg\"></div> </td>\n"; #$content .= "(".Message::getInstance()->getMessage(MSG_FILE_NONE).") </td>\n"; } } else { if (isset($this->form->helpers[$v['name']])) { $content .= " <td>{$v["label"]} <a href=# title=\"{$this->form->helpers[$v['name']]}\"><img src=\"img/form/help.gif\" class=\"helper\"></a> </td>\n"; } else { echo $label = $v['label']; //$content .= '<label>'.$v["label"].'</label>'; } //$this->name = $v['name']; //$content .= '<input type="file" name="'.$v['name'].'" />'; } $widget = new Skinlet("widget/FileField"); $widget->setContent("label", $this->label); $widget->setContent("name", $this->name); $widget->setContent('value', $value); $widget->setContent("loggedUsername", $_SESSION["user"]["username"]); $widget->setContent("preloadedImageId", $preloadedId); return $widget->get(); }
<?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(); }
<?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();