示例#1
0
 /**
  * Construct the widget
  *
  * @access  private
  */
 function buildXHTML()
 {
     $colorpicker = PIWI_URL . 'piwidata/js/colorpicker/ColorPicker2.js';
     $popup = PIWI_URL . 'piwidata/js/colorpicker/PopupWindow.js';
     $anchor = PIWI_URL . 'piwidata/js/colorpicker/AnchorPosition.js';
     $this->addFile($colorpicker);
     $this->addFile($popup);
     $this->addFile($anchor);
     $pickerName = $this->_id . '_colorpicker';
     $this->_XHTML = "<script type=\"text/javascript\">\n";
     $this->_XHTML .= "var " . $pickerName . "_properties = [];\n";
     $this->_XHTML .= $pickerName . "_properties['windowname'] = '" . $this->_popupName . "';\n";
     $this->_XHTML .= $pickerName . "_properties['fontStyle'] = '" . $this->_colorFontStyle . "';\n";
     $this->_XHTML .= $pickerName . "_properties['fieldID'] = '" . $this->_entry->getID() . "';\n";
     if (!empty($this->_onSelectEvent)) {
         $this->_onSelectEvent = " " . $this->_onSelectEvent . " ";
     }
     $this->_XHTML .= $pickerName . "_properties['onselect'] = '" . $this->_onSelectEvent . "';\n";
     if ($this->_usePopup) {
         $this->_XHTML .= "var " . $pickerName . " = new ColorPicker('window'," . $pickerName . "_properties);\n";
     } else {
         $this->_XHTML .= "var " . $pickerName . " = new ColorPicker(''," . $pickerName . "_properties);\n";
     }
     $this->_XHTML .= "</script>\n";
     $this->_button->addEvent(ON_CLICK, $pickerName . ".select(document.getElementById('" . $this->_entry->getID() . "'), " . "'" . $pickerName . "_ahref'); return false;");
     if (!empty($this->_onSelectEvent)) {
         $this->_entry->addEvent(ON_CHANGE, $this->_onSelectEvent);
     }
     if ($this->_hideInput) {
         $this->_entry->setType("hidden");
     }
     $this->_XHTML .= "<table border=\"0\" style=\"border-spacing: 0px; padding: 0px; border: 0px;\">\n";
     $this->_XHTML .= " <tr>\n";
     $this->_XHTML .= "  <td>\n";
     $this->_XHTML .= "<script type=\"text/javascript\">\n";
     $this->_XHTML .= "function ExecutePingBackOf" . $this->_entry->getID() . "() {\n";
     $this->_XHTML .= "  " . $this->_onSelectEvent . "\n";
     $this->_XHTML .= "}\n";
     $this->_XHTML .= "</script>\n";
     $this->_XHTML .= $this->_entry->get();
     $this->_XHTML .= "  </td>\n";
     $this->_XHTML .= "  <td>\n";
     $this->_XHTML .= "<a id=\"" . $pickerName . "_ahref\"></a>\n";
     $this->_XHTML .= $this->_button->get();
     $this->_XHTML .= "<script type=\"text/javascript\">\n";
     $this->_XHTML .= $pickerName . ".writeDiv();\n";
     $this->_XHTML .= "</script>\n";
     $this->_XHTML .= "  </td>\n";
     $this->_XHTML .= " </tr>\n";
     $this->_XHTML .= "</table>";
 }
示例#2
0
文件: Entry.php 项目: nvdnkpr/h5ai
 public function getContent()
 {
     $content = array();
     if ($this->h5ai->getHttpCode($this->absHref) !== "h5ai") {
         return $content;
     }
     $files = $this->h5ai->read_dir($this->absPath);
     foreach ($files as $file) {
         $entry = Entry::get($this->h5ai, $this->absPath . "/" . $file, $this->absHref . rawurlencode($file));
         $content[$entry->absPath] = $entry;
     }
     $this->isContentFetched = true;
     return $content;
 }
示例#3
0
 public function get_content(&$cache)
 {
     $content = array();
     if ($this->app->get_http_code($this->abs_href) !== App::$MAGIC_SEQUENCE) {
         return $content;
     }
     $files = $this->app->read_dir($this->abs_path);
     foreach ($files as $file) {
         $entry = Entry::get($this->app, $this->abs_path . "/" . $file, $cache);
         $content[$entry->abs_path] = $entry;
     }
     $this->is_content_fetched = true;
     return $content;
 }
示例#4
0
 public function doPOST()
 {
     require_once DB_PATH . '/core/lib/entry.php';
     $id = intval($this->request->entry);
     try {
         $entry = new Entry($this->db, $id);
         if (!($this->auth->authenticated() && $entry->get('user') == $_SESSION['auth_id'])) {
             $entry->check_pass($_POST['password']);
         }
         $entry->update_tags($_POST['tags']);
         $entry->update('title', $_POST['title']);
         $entry->update('safe', intval($_POST['rating']));
         $entry->save();
         redirect('view', $id);
     } catch (Exception $e) {
         die($e->GetMessage());
         redirect('edit', $id);
     }
 }
 public function getEntryValue(Entry $entry)
 {
     if (!$this->initialize()) {
         return '';
     }
     $section = $this->getSection($entry->get('section_id'));
     $field = @array_shift($section->fetchVisibleColumns());
     $span = new XMLElement('span');
     if (is_null($field)) {
         return '';
     }
     $data = $entry->getData($field->get('id'));
     if (empty($data)) {
         return '';
     }
     $data = $field->prepareTableValue($data, $span);
     if ($data instanceof XMLElement) {
         $data = $data->generate();
     }
     return strip_tags($data);
 }
示例#6
0
 public function download_entries_all()
 {
     header('Content-Type: application/excel');
     header('Content-Disposition: attachment; filename="xls/all-entries.csv"');
     $config = Config::get("config");
     $prepareEntries = Entry::get();
     if (count($prepareEntries)) {
         $tableheaders = '#,Facebook ID,First Name,Last Name,Email,Gender,Tone,Profile,Created At';
         $data = array();
         array_push($data, $tableheaders);
         foreach ($prepareEntries as $row) {
             $item = $row['id'] . "," . $row['facebook_id'] . "," . $row['first_name'] . "," . $row['last_name'] . "," . $row['email'] . "," . $row['gender'] . "," . $row['tone'] . "," . $row['profile'] . "," . $row['created_at'];
             array_push($data, $item);
         }
         $fp = fopen('php://output', 'w');
         foreach ($data as $line) {
             $val = explode(",", $line);
             fputcsv($fp, $val);
         }
         fclose($fp);
     } else {
         return "No Entries to Download";
     }
 }
 /**
  * This function handles the Send Mail filter which will send an email
  * to each specified recipient informing them that an Entry has been
  * created.
  *
  * @param XMLElement $result
  *  The XMLElement of the XML that is going to be returned as part
  *  of this event to the page.
  * @param array $send_mail
  *  Associative array of `send-mail` parameters.
  * @param array $fields
  *  Array of post data to extract the values from
  * @param Section $section
  *  This Section for this event
  * @param Section $section
  *  This current Entry that has just been updated or created
  * @return XMLElement
  *  The modified `$result` with the results of the filter.
  */
 public function processSendMailFilter(XMLElement $result, array $send_email, array &$fields, Section $section, Entry $entry)
 {
     $fields['recipient'] = self::replaceFieldToken($send_email['recipient'], $fields);
     $fields['recipient'] = preg_split('/\\,/i', $fields['recipient'], -1, PREG_SPLIT_NO_EMPTY);
     $fields['recipient'] = array_map('trim', $fields['recipient']);
     $fields['subject'] = self::replaceFieldToken($send_email['subject'], $fields, __('[Symphony] A new entry was created on %s', array(Symphony::Configuration()->get('sitename', 'general'))));
     $fields['body'] = self::replaceFieldToken($send_email['body'], $fields, null, false, false);
     $fields['sender-email'] = self::replaceFieldToken($send_email['sender-email'], $fields);
     $fields['sender-name'] = self::replaceFieldToken($send_email['sender-name'], $fields);
     $fields['reply-to-name'] = self::replaceFieldToken($send_email['reply-to-name'], $fields);
     $fields['reply-to-email'] = self::replaceFieldToken($send_email['reply-to-email'], $fields);
     $edit_link = SYMPHONY_URL . '/publish/' . $section->get('handle') . '/edit/' . $entry->get('id') . '/';
     $language = Symphony::Configuration()->get('lang', 'symphony');
     $template_path = Event::getNotificationTemplate($language);
     $body = sprintf(file_get_contents($template_path), $section->get('name'), $edit_link);
     if (is_array($fields['body'])) {
         foreach ($fields['body'] as $field_handle => $value) {
             $body .= "// {$field_handle}" . PHP_EOL . $value . PHP_EOL . PHP_EOL;
         }
     } else {
         $body .= $fields['body'];
     }
     // Loop over all the recipients and attempt to send them an email
     // Errors will be appended to the Event XML
     $errors = array();
     foreach ($fields['recipient'] as $recipient) {
         $author = AuthorManager::fetchByUsername($recipient);
         if (empty($author)) {
             $errors['recipient'][$recipient] = __('Recipient not found');
             continue;
         }
         $email = Email::create();
         // Huib: Exceptions are also thrown in the settings functions, not only in the send function.
         // Those Exceptions should be caught too.
         try {
             $email->recipients = array($author->get('first_name') => $author->get('email'));
             if ($fields['sender-name'] != null) {
                 $email->sender_name = $fields['sender-name'];
             }
             if ($fields['sender-email'] != null) {
                 $email->sender_email_address = $fields['sender-email'];
             }
             if ($fields['reply-to-name'] != null) {
                 $email->reply_to_name = $fields['reply-to-name'];
             }
             if ($fields['reply-to-email'] != null) {
                 $email->reply_to_email_address = $fields['reply-to-email'];
             }
             $email->text_plain = str_replace('<!-- RECIPIENT NAME -->', $author->get('first_name'), $body);
             $email->subject = $fields['subject'];
             $email->send();
         } catch (EmailValidationException $e) {
             $errors['address'][$author->get('email')] = $e->getMessage();
         } catch (EmailGatewayException $e) {
             $errors['gateway'][$author->get('email')] = $e->getMessage();
         } catch (EmailException $e) {
             $errors['email'][$author->get('email')] = $e->getMessage();
         }
     }
     // If there were errors, output them to the event
     if (!empty($errors)) {
         $xml = self::buildFilterElement('send-email', 'failed');
         foreach ($errors as $type => $messages) {
             $xType = new XMLElement('error');
             $xType->setAttribute('error-type', $type);
             foreach ($messages as $recipient => $message) {
                 $xType->appendChild(new XMLElement('message', $message, array('recipient' => $recipient)));
             }
             $xml->appendChild($xType);
         }
         $result->appendChild($xml);
     } else {
         $result->appendChild(self::buildFilterElement('send-email', 'passed'));
     }
     return $result;
 }
 private function __wrapFieldWithDiv(Field $field, Entry $entry, $prefix = null, $postfix = null, $css = null)
 {
     $div = new XMLElement('div', NULL, array('class' => 'field field-' . $field->handle() . ($field->get('required') == 'yes' ? ' required' : '')));
     if ($css != null) {
         $div->setAttribute('style', $css);
     }
     $field->displayPublishPanel($div, $_POST['fields'][$field->get('element_name')], isset($this->_errors[$field->get('id')]) ? $this->_errors[$field->get('id')] : NULL, $prefix ? '[' . $prefix . ']' : null, null, is_numeric($entry->get('id')) ? $entry->get('id') : NULL);
     return $div;
 }
示例#9
0
 public function get_no_js_fallback()
 {
     date_default_timezone_set("UTC");
     $cache = array();
     $folder = Entry::get($this, $this->abs_path, $cache);
     $entries = $folder->get_content($cache);
     uasort($entries, array("Entry", "cmp"));
     $html = "<table>";
     $html .= "<tr><th></th><th><span>Name</span></th><th><span>Last modified</span></th><th><span>Size</span></th></tr>";
     if ($folder->get_parent($cache)) {
         $html .= "<tr><td><img src=\"" . $this->app_abs_href . "client/icons/16x16/folder-parent.png\"/></td><td><a href=\"..\">Parent Directory</a></td><td></td><td></td></tr>";
     }
     foreach ($entries as $entry) {
         $html .= "<tr>";
         $html .= "<td><img src=\"" . $this->app_abs_href . "client/icons/16x16/" . ($entry->is_folder ? "folder" : "default") . ".png\"/></td>";
         $html .= "<td><a href=\"" . $entry->abs_href . "\">" . basename($entry->abs_path) . "</a></td>";
         $html .= "<td>" . date("Y-m-d H:i", $entry->date) . "</td>";
         $html .= "<td>" . ($entry->size !== null ? intval($entry->size / 1000) . " KB" : "") . "</td>";
         $html .= "</tr>";
     }
     $html .= "</table>";
     return $html;
 }
示例#10
0
 public function prepareAssociationsDrawerXMLElement(Entry $e, array $parent_association, $prepolutate = '')
 {
     $currentSection = SectionManager::fetch($parent_association['child_section_id']);
     $visibleCols = $currentSection->fetchVisibleColumns();
     $outputFieldId = current(array_keys($visibleCols));
     $outputField = FieldManager::fetch($outputFieldId);
     $value = $outputField->prepareReadableValue($e->getData($outputFieldId), $e->get('id'), true, __('None'));
     $li = new XMLElement('li');
     $li->setAttribute('class', 'field-' . $this->get('type'));
     $a = new XMLElement('a', strip_tags($value));
     $a->setAttribute('href', SYMPHONY_URL . '/publish/' . $parent_association['handle'] . '/edit/' . $e->get('id') . '/');
     $li->appendChild($a);
     return $li;
 }
示例#11
0
 /**
  * Format this field value for display in the Associations Drawer publish index.
  * By default, Symphony will use the return value of the `prepareReadableValue` function.
  *
  * @since Symphony 2.4
  * @since Symphony 2.5.0 The prepopulate parameter was added.
  *
  * @param Entry $e
  *   The associated entry
  * @param array $parent_association
  *   An array containing information about the association
  * @param string $prepopulate
  *   A string containing prepopulate parameter to append to the association url
  *
  * @return XMLElement
  *   The XMLElement must be a li node, since it will be added an ul node.
  */
 public function prepareAssociationsDrawerXMLElement(Entry $e, array $parent_association, $prepopulate = '')
 {
     $value = $this->prepareReadableValue($e->getData($this->get('id')), $e->get('id'));
     // fallback for compatibility since the default
     // `preparePlainTextValue` is not compatible with all fields
     // this should be removed in Symphony 3.0
     if (empty($value)) {
         $value = strip_tags($this->prepareTableValue($e->getData($this->get('id')), null, $e->get('id')));
     }
     // use our factory method to create the html
     $li = self::createAssociationsDrawerXMLElement($value, $e, $parent_association, $prepopulate);
     $li->setAttribute('class', 'field-' . $this->get('type'));
     return $li;
 }
示例#12
0
文件: H5ai.php 项目: rsertelon/h5ai
 public function getNoJsFallback()
 {
     date_default_timezone_set("UTC");
     function _cmp($entry1, $entry2)
     {
         if ($entry1->isFolder && !$entry2->isFolder) {
             return -1;
         }
         if (!$entry1->isFolder && $entry2->isFolder) {
             return 1;
         }
         return strcasecmp($entry1->absHref, $entry2->absHref);
     }
     $folder = Entry::get($this, $this->absPath, $this->absHref);
     $entries = $folder->getContent();
     uasort($entries, "_cmp");
     $html = "<table>";
     $html .= "<tr><th></th><th><span>Name</span></th><th><span>Last modified</span></th><th><span>Size</span></th></tr>";
     if ($folder->parent) {
         $html .= "<tr><td></td><td><a href=\"..\">Parent Directory</a></td><td></td><td></td></tr>";
     }
     foreach ($entries as $entry) {
         $html .= "<tr>";
         $html .= "<td></td>";
         $html .= "<td><a href=\"" . $entry->absHref . "\">" . basename($entry->absPath) . ($entry->isFolder ? "/" : "") . "</a></td>";
         $html .= "<td>" . date("Y-m-d H:i", $entry->date) . "</td>";
         $html .= "<td>" . ($entry->size !== null ? intval($entry->size / 1000) . " KB" : "") . "</td>";
         $html .= "</tr>";
     }
     $html .= "</table>";
     return $html;
 }
 /**
  * Format this field value for display in the Associations Drawer publish index.
  * By default, Symphony will use the return value of the `prepareTableValue` function.
  * 
  * @param Entry $e
  *   The associated entry
  * @param array $parent_association
  *   An array containing information about the parent
  *
  * return XMLElement
  *   The XMLElement must be a li node, since it will be added an ul node.
  */
 public function prepareAssociationsDrawerXMLElement(Entry $e, array $parent_association)
 {
     $value = $this->prepareTableValue($e->getData($this->get('id')), null, $e->get('id'));
     $li = new XMLElement('li');
     $li->setAttribute('class', 'field-' . $this->get('type'));
     $a = new XMLElement('a', strip_tags($value));
     $a->setAttribute('href', SYMPHONY_URL . '/publish/' . $parent_association['handle'] . '/edit/' . $e->get('id') . '/');
     $li->appendChild($a);
     return $li;
 }
 /**
  * Update an existing Entry object given an Entry object
  *
  * @param Entry $entry
  *  An Entry object
  * @return boolean
  */
 public function edit(Entry $entry)
 {
     foreach ($entry->getData() as $field_id => $field) {
         if (empty($field_id)) {
             continue;
         }
         try {
             Symphony::Database()->delete('tbl_entries_data_' . $field_id, " `entry_id` = '" . $entry->get('id') . "'");
         } catch (Exception $e) {
             // Discard?
         }
         if (!is_array($field) || empty($field)) {
             continue;
         }
         $data = array('entry_id' => $entry->get('id'));
         $fields = array();
         foreach ($field as $key => $value) {
             if (is_array($value)) {
                 foreach ($value as $ii => $v) {
                     $fields[$ii][$key] = $v;
                 }
             } else {
                 $fields[max(0, count($fields) - 1)][$key] = $value;
             }
         }
         foreach ($fields as $index => $field_data) {
             $fields[$index] = array_merge($data, $field_data);
         }
         Symphony::Database()->insert($fields, 'tbl_entries_data_' . $field_id);
     }
     return true;
 }
 /**
  * Given a Field and Entry object, this function will wrap
  * the Field's displayPublishPanel result with a div that
  * contains some contextual information such as the Field ID,
  * the Field handle and whether it is required or not.
  *
  * @param Field $field
  * @param Entry $entry
  * @return XMLElement
  */
 private function __wrapFieldWithDiv(Field $field, Entry $entry)
 {
     $div = new XMLElement('div', NULL, array('id' => 'field-' . $field->get('id'), 'class' => 'field field-' . $field->handle() . ($field->get('required') == 'yes' ? ' required' : '')));
     $field->displayPublishPanel($div, $entry->getData($field->get('id')), isset($this->_errors[$field->get('id')]) ? $this->_errors[$field->get('id')] : NULL, null, null, is_numeric($entry->get('id')) ? $entry->get('id') : NULL);
     return $div;
 }
 /**
  * Update an existing Entry object given an Entry object
  *
  * @param Entry $entry
  *  An Entry object
  * @throws DatabaseException
  * @return boolean
  */
 public static function edit(Entry $entry)
 {
     // Update modification date.
     Symphony::Database()->update(array('modification_date' => $entry->get('modification_date'), 'modification_date_gmt' => $entry->get('modification_date_gmt')), 'tbl_entries', sprintf(' `id` = %d', $entry->get('id')));
     // Iterate over all data for this entry, deleting existing data first
     // then inserting a new row for the data
     foreach ($entry->getData() as $field_id => $field) {
         if (empty($field_id)) {
             continue;
         }
         try {
             Symphony::Database()->delete('tbl_entries_data_' . $field_id, sprintf("\n                    `entry_id` = %d", $entry->get('id')));
         } catch (Exception $e) {
             // Discard?
         }
         if (!is_array($field) || empty($field)) {
             continue;
         }
         $data = array('entry_id' => $entry->get('id'));
         $fields = array();
         foreach ($field as $key => $value) {
             if (is_array($value)) {
                 foreach ($value as $ii => $v) {
                     $fields[$ii][$key] = $v;
                 }
             } else {
                 $fields[max(0, count($fields) - 1)][$key] = $value;
             }
         }
         foreach ($fields as $index => $field_data) {
             $fields[$index] = array_merge($data, $field_data);
         }
         Symphony::Database()->insert($fields, 'tbl_entries_data_' . $field_id);
     }
     return true;
 }
示例#17
0
 private function __sendNewRegistrationEmail(Entry $entry, array $fields = array())
 {
     if (!($role = $this->fetchRole($entry->getData($this->roleField(), true)->role_id))) {
         return;
     }
     $email_template = EmailTemplate::find($role->id() == self::INACTIVE_ROLE_ID ? 'activate-account' : 'welcome', $role->id());
     $member_field_handle = $this->usernameAndPasswordFieldHandle();
     return $email_template->send($entry->get('id'), array('root' => URL, "{$member_field_handle}::plaintext-password" => $fields[$member_field_handle]['password'], "{$member_field_handle}::username" => $fields[$member_field_handle]['username'], 'code' => $this->generateCode($entry->get('id')), 'site-name' => Symphony::Configuration()->get('sitename', 'general')));
 }
示例#18
0
 function _buildXHTML()
 {
     $this->_entry->setReadOnly($this->_readOnly);
     $this->_entry->setEnabled($this->_isEnabled);
     $this->_button->setEnabled($this->_isEnabled);
     $this->_XHTML = "<table";
     $this->_XHTML .= $this->buildBasicXHTML();
     $this->_XHTML .= $this->buildJSEvents();
     $this->_XHTML .= ">\n";
     $this->_XHTML .= " <tr>\n";
     $this->_XHTML .= "  <td>\n";
     $this->_XHTML .= $this->_entry->get();
     $this->_XHTML .= "  </td>\n";
     $this->_XHTML .= "  <td>\n";
     $this->_XHTML .= $this->_button->get();
     $this->_XHTML .= "  </td>\n";
     $this->_XHTML .= " </tr>\n";
     $this->_XHTML .= "</table>";
 }
 /**
  * Given an Entry object, a `$field_id` and an array of `$data`, this
  * function iterates over the `dsParamPARAMOUTPUT` and will call the
  * field's (identified by `$field_id`) `getParameterPoolValue` function
  * to add parameters to the `$this->_param_pool`.
  *
  * @param Entry $entry
  * @param integer $field_id
  * @param array $data
  */
 public function processOutputParameters(Entry $entry, $field_id, array $data)
 {
     if (!isset($this->dsParamPARAMOUTPUT)) {
         return;
     }
     // Support the legacy parameter `ds-datasource-handle`
     $key = 'ds-' . $this->dsParamROOTELEMENT;
     $singleParam = count($this->dsParamPARAMOUTPUT) == 1;
     if ($singleParam && (!isset($this->_param_pool[$key]) || !is_array($this->_param_pool[$key]))) {
         $this->_param_pool[$key] = array();
     }
     foreach ($this->dsParamPARAMOUTPUT as $param) {
         if (self::$_fieldPool[$field_id]->get('element_name') !== $param) {
             continue;
         }
         // The new style of paramater is `ds-datasource-handle.field-handle`
         $param_key = $key . '.' . str_replace(':', '-', $param);
         if (!isset($this->_param_pool[$param_key]) || !is_array($this->_param_pool[$param_key])) {
             $this->_param_pool[$param_key] = array();
         }
         $param_pool_values = self::$_fieldPool[$field_id]->getParameterPoolValue($data, $entry->get('id'));
         if (is_array($param_pool_values)) {
             $this->_param_pool[$param_key] = array_merge($param_pool_values, $this->_param_pool[$param_key]);
             if ($singleParam) {
                 $this->_param_pool[$key] = array_merge($param_pool_values, $this->_param_pool[$key]);
             }
         } else {
             $this->_param_pool[$param_key][] = $param_pool_values;
             if ($singleParam) {
                 $this->_param_pool[$key][] = $param_pool_values;
             }
         }
     }
 }
 /**
  * Given a Field and Entry object, this function will wrap
  * the Field's displayPublishPanel result with a div that
  * contains some contextual information such as the Field ID,
  * the Field handle and whether it is required or not.
  *
  * @param Field $field
  * @param Entry $entry
  * @return XMLElement
  */
 private function __wrapFieldWithDiv(Field $field, Entry $entry)
 {
     $is_hidden = $this->isFieldHidden($field);
     $div = new XMLElement('div', null, array('id' => 'field-' . $field->get('id'), 'class' => 'field field-' . $field->handle() . ($field->get('required') == 'yes' ? ' required' : '') . ($is_hidden === true ? ' irrelevant' : '')));
     $field->setAssociationContext($div);
     $field->displayPublishPanel($div, $entry->getData($field->get('id')), isset($this->_errors[$field->get('id')]) ? $this->_errors[$field->get('id')] : null, null, null, is_numeric($entry->get('id')) ? $entry->get('id') : null);
     /**
      * Allows developers modify the field before it is rendered in the publish
      * form. Passes the `Field` object, `Entry` object, the `XMLElement` div and
      * any errors for the entire `Entry`. Only the `$div` element
      * will be altered before appending to the page, the rest are read only.
      *
      * @since Symphony 2.5.0
      * @delegate ModifyFieldPublishWidget
      * @param string $context
      * '/backend/'
      * @param Field $field
      * @param Entry $entry
      * @param array $errors
      * @param Widget $widget
      */
     Symphony::ExtensionManager()->notifyMembers('ModifyFieldPublishWidget', '/backend/', array('field' => $field, 'entry' => $entry, 'errors' => $this->_errors, 'widget' => &$div));
     return $div;
 }
示例#21
0
 function DataGridCapture($numrows, $numcolumns, $titles, $gadget, $action, $entry_type, $caption = '', $id = '')
 {
     $this->_name = 'datagridcapture';
     $this->_class = 'datagrid';
     $this->_columns = array();
     $this->_caption = $caption;
     $this->_actionColumns = array();
     $this->_data = array();
     if (empty($id)) {
         $this->_id = 'datagridcapture_' . rand(1, 100);
     } else {
         $this->_id = $id;
     }
     /*if (is_array($data)) {
           $this->_data = $data;
       } else {
           die("beh!");
       }
       */
     $this->setOddColor('#eee');
     $this->setEvenColor('#fff');
     for ($id = 0; $id < $numrows; $id++) {
         $idtext = $this->_id . '_' . $id;
         $keyField1 = new Entry('name_' . $idtext, str_replace('"', '&quot;', ''));
         #$keyField->setStyle('background: transparent;border-style: solid; border: 10px;');
         $keyField1->setStyle('border-style: solid; border: 10px;');
         $keyField1->setEnabled(true);
         $keyField1->setSize(30);
         $data[$id]['key'] = $keyField1->get();
         $keyField2 = new Entry('value_' . $idtext, str_replace('"', '&quot;', ''));
         $keyField2->setStyle('background: transparent; border: 1px;');
         $keyField2->setEnabled(true);
         $keyField2->setSize(30);
         $data[$id]['value'] = $keyField2->get();
         $data[$id]['action'] = '<a OnClick="javascript: if(confirm(\'Are this values correct?\')) { window.location=\'?gadget=' . $gadget . '&action=' . $action . '&id=' . $id . '&key=\'+document.getElementById(\'' . $keyField1->getID() . '\').value+\'&value=\'+document.getElementById(\'' . $keyField2->getID() . '\').value+\'&entry_type=' . $entry_type . '\';}"><img id="imgcat' . $id . '" src="images/stock/save.png" border="0" alt="" /></a>';
     }
     parent::init();
     foreach ($titles as $t) {
         $this->addColumn(new Column(_("{$t}"), "{$t}", true));
     }
     $this->addData($data);
 }
示例#22
0
文件: H5ai.php 项目: nvdnkpr/h5ai
 public function getEntries($absHref, $content)
 {
     $folder = Entry::get($this, $this->getAbsPath($absHref), $absHref);
     if ($content > 1 && $folder !== null) {
         foreach ($folder->getContent() as $entry) {
             $entry->getContent();
         }
         $folder = $folder->getParent();
     }
     while ($content > 0 && $folder !== null) {
         $folder->getContent();
         $folder = $folder->getParent();
     }
     Entry::sort();
     $entries = array();
     foreach (Entry::get_cache() as $entry) {
         $entries[] = $entry->toJsonObject(true);
     }
     return $entries;
 }