Ejemplo n.º 1
0
 /**
  * Show the entry ledger details
  */
 function entryLedgers($id)
 {
     /* Load the Entry model */
     App::import("Webzash.Model", "Entry");
     $Entry = new Entry();
     return $Entry->entryLedgers($id);
 }
 public function performHandlerTasks()
 {
     if (($author_id = Application::param('author_id')) && ($entry_id = Application::param('entry_id'))) {
         $entry = new Entry();
         $entry->clauseSafe('author_id', $author_id);
         $entry->clauseSafe('entry_id', $entry_id);
         $this->entry_to_manage_for = $entry;
     } else {
         $this->redirectOnAccessDenied();
     }
     if (!LogbookAccess::currentUserCanManageAccess($this->entryToManageFor())) {
         $this->redirectOnAccessDenied();
     }
     if ($group_id = Application::param('group_id')) {
         $this->group_to_manage_for = new Group();
         $this->group_to_manage_for->clauseSafe('group_id', $group_id);
     }
     if (Application::formPosted()) {
         if (Application::param('choose_group')) {
             $this->chooseGroup();
         }
         if (Application::param('manage_access')) {
             $this->manageAccess();
         }
     }
 }
Ejemplo n.º 3
0
 public function indexAction()
 {
     $entries = new Entry();
     // test memcached
     if (extension_loaded('memcache')) {
         $mem = new Memcache();
         $mem->addServer('localhost', 11211);
         $result = $mem->get('indexContent');
         if (!$result) {
             $result = $entries->fetchLatest(100);
             $mem->set('indexContent', $result, 0, 4);
         }
     } else {
         $result = $entries->fetchLatest(100);
     }
     if ($result) {
         $this->view->entries = $result;
         // Zend_Paginator
         $page = $this->_request->getParam('page', 1);
         $paginator = Zend_Paginator::factory($result);
         $paginator->setItemCountPerPage(4);
         $paginator->setCurrentPageNumber($page);
         $this->view->paginator = $paginator;
     }
 }
Ejemplo n.º 4
0
 public function add(Entry $entry)
 {
     if (!$entry instanceof Entry) {
         throw InvalidArgumentException('引数の型が不正です');
     }
     $this->directory[] = $entry;
     $entry->setParent($this);
 }
Ejemplo n.º 5
0
 public function addEntry($data, $program)
 {
     $entry = new Entry();
     $entry->fromData($data, $program);
     array_push($this->entries, $entry);
     writeLog('Loaded entry for program ' . $program->id . ' (', $program->year . ')');
     return $entry;
 }
Ejemplo n.º 6
0
 public function postAdd($p, $z)
 {
     //	update Zoop::Form so that it it can handle consolidating the edit and view pages here
     $entry = new Entry();
     $entry->start = $_POST['start'];
     $entry->end = $_POST['end'];
     $entry->title = $_POST['title'];
     $entry->is_duration = isset($_POST['is_duration']) && $_POST['is_duration'] ? 1 : 0;
     $entry->save();
     $this->redirect('');
 }
Ejemplo n.º 7
0
 public static function importEntry($path)
 {
     $parts = explode('/', $path);
     $info = explode('_', $parts[count($parts) - 2]);
     //	do the database part
     $entry = new Entry((int) $info[0]);
     $entry->name = $info[1];
     $entry->assignHeaders();
     $entry->save();
     //	do the file system part
     $entry->cacheContent();
 }
Ejemplo n.º 8
0
 function getTags(Entry $entry)
 {
     $sql = "SELECT tags.id_tag as id, tags.tag_text\n\t\t\t\tFROM entry2tag\n\t\t\t\tINNER JOIN tags\n\t\t\t\tON entry2tag.id_tag = tags.id_tag\n\t\t\t\tWHERE entry2tag.id_entry = :id";
     try {
         $query = $this->db->prepare($sql);
         $query->execute(array(':id' => $entry->getId()));
     } catch (PDOException $e) {
         return $e->getMessage();
     }
     $tags = $query->fetchAll(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, "Tag");
     $entry->setTags($tags);
 }
Ejemplo n.º 9
0
 public static function importEntry($path)
 {
     $info = self::parsePath($path);
     //	do the database part
     $entry = new Entry((int) $info['id']);
     $entry->name = $info['name'];
     $entry->simple = $info['simple'];
     $entry->assignHeaders();
     $entry->save();
     //	do the file system part
     $entry->cacheContent();
 }
Ejemplo n.º 10
0
 public function entry_count()
 {
     $child_class = $this->class === 'category' ? 'entry' : 'page';
     $blog_id = $this->blog_id;
     $cat_id = $this->id;
     $where = "entry_status = 2\n                  and entry_class = '{$child_class}'\n                  and entry_blog_id = {$blog_id}";
     $join = array();
     $join['mt_placement'] = array('condition' => "placement_entry_id = entry_id and placement_category_id = {$cat_id}");
     require_once 'class.mt_entry.php';
     $entry = new Entry();
     $cnt = $entry->count(array('where' => $where, 'join' => $join));
     return $cnt;
 }
Ejemplo n.º 11
0
 /**
  * Create the view payload
  * @param \mdref\Entry $ref
  * @param \mdref\Generator\Renderer $view
  * @return \stdClass
  */
 private function createPayload(Entry $ref = null)
 {
     $pld = new \stdClass();
     $pld->quick = [$this->reference, "formatString"];
     $pld->file = [$this->reference, "formatFile"];
     $pld->refs = $this->reference;
     $pld->view = $this->renderer;
     if ($ref) {
         $pld->entry = $ref;
         $pld->ref = $ref->getName();
     }
     return $pld;
 }
Ejemplo n.º 12
0
 public function save()
 {
     $transaction = $this->beginTransaction();
     try {
         $entry = new Entry();
         $entry->newEntry($this->getEntry());
         parent::save();
         $transaction->commit();
     } catch (\Exception $e) {
         $transaction->rollback();
         throw new \Exception($e->getMessage());
     }
 }
Ejemplo n.º 13
0
 public function processData($data, Entry $entry = null)
 {
     $driver = Extension::load('members');
     if (isset($entry->data()->{$this->{'element-name'}})) {
         $result = $entry->data()->{$this->{'element-name'}};
     } else {
         $result = (object) array('value' => null);
     }
     if (!is_null($data)) {
         $result->value = $data;
     }
     return $result;
 }
Ejemplo n.º 14
0
 public static function importEntry($path)
 {
     $parts = explode('/', $path);
     $dir = $parts[count($parts) - 2];
     $id = (int) substr($dir, 0, strpos($dir, '_'));
     $name = substr($dir, strpos($dir, '_') + 1);
     //	do the database part
     $entry = new Entry($id);
     $entry->name = $name;
     $entry->assignHeaders();
     $entry->save();
     //	do the file system part
     $entry->cacheContent();
 }
Ejemplo n.º 15
0
 public function updateEntry($newEntry)
 {
     $transaction = $this->beginTransaction();
     try {
         $this->setTimeLine(Base::updateTimeLine($this->getEntry(), $newEntry));
         $entry = new Entry();
         $entry->updateEntry($this->getEntry(), $newEntry);
         $this->setEntry($newEntry);
         parent::save();
         $transaction->commit();
     } catch (\Exception $e) {
         $transaction->rollback();
         throw new \Exception($e->getMessage());
     }
 }
Ejemplo n.º 16
0
 public function __construct(\steam_room $room)
 {
     parent::__construct($room);
     $this->entryAttributes["academictype"] = array("attributeName" => PORTFOLIO_PREFIX . "ENTRY_ACADEMIC_TYPE", "label" => "Akademischer Abschluss", "description" => "", "values" => array(array("name" => "", "value" => 0), array("name" => "Bachelor", "value" => 1), array("name" => "Master", "value" => 2), array("name" => "Sonstiger", "value" => 3)), "defaultValue" => "");
     $this->entryAttributes["academicinstitution"] = array("attributeName" => PORTFOLIO_PREFIX . "ENTRY_ACADEMIC_INSTITUTION", "label" => "Ausbildungseinrichtung", "description" => "", "values" => "", "defaultValue" => "");
     $this->entryAttributes["academicgrade"] = array("attributeName" => PORTFOLIO_PREFIX . "ENTRY_ACADEMIC_GRADE", "label" => "Druchschnittsnote", "description" => "", "values" => array(array("name" => "", "value" => 0), array("name" => "Sehr gut (1)", "value" => 1), array("name" => "Gut (2)", "value" => 2), array("name" => "Befriedigend (3)", "value" => 3), array("name" => "Ausreichend (4)", "value" => 4)), "defaultValue" => "");
 }
Ejemplo n.º 17
0
 public function sdkLoader()
 {
     // Variables
     $category = [];
     $cart = [];
     unset($_SESSION);
     // Load the SDK
     $moltin = new \Moltin\SDK\SDK(new \Moltin\SDK\Storage\Session(), new \Moltin\SDK\Request\CURL(), ['url' => isset($this->config['moltin_api_url']) ? $this->config['moltin_api_url'] : null, 'auth_url' => isset($this->config['moltin_api_auth_url']) ? $this->config['moltin_api_auth_url'] : null, 'version' => isset($this->config['moltin_api_version']) ? $this->config['moltin_api_version'] : null]);
     \Moltin::Authenticate('ClientCredentials', ['client_id' => $this->config['api_client_id'], 'client_secret' => $this->config['api_client_secret']]);
     try {
         // Get categories
         $categories = \Category::Tree(['status' => 1]);
     } catch (\Exception $e) {
         exit($e->getMessage());
     }
     try {
         // Get cart contents
         $cart = \Cart::Contents()['result'];
     } catch (\Exception $e) {
         exit($e->getMessage());
     }
     try {
         // Get pages
         $pages = \Entry::Find('page', ['status' => 1])['result'];
     } catch (\Exception $e) {
         exit($e->getMessage());
     }
     // add cart to app - so it can be accessed in controllers
     $this->app->cart = $cart;
     // Assign to view
     $this->app->view()->appendData(['categories' => $categories['result'], 'cart' => $cart]);
 }
Ejemplo n.º 18
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $x = 1;
     foreach (Group::all() as $group) {
         $contents = Content::where('group_id', $group->getKey())->count();
         $entries = Entry::where('group_id', $group->getKey())->count();
         $total = $contents + $entries;
         // Default activity is medium = 2
         $group->activity = 2;
         // Low activity, when nothing was added last week
         if ($total == 0) {
             $group->activity = 1;
         }
         if ($total > 15) {
             $group->activity = 3;
         }
         if ($total > 50) {
             $group->activity = 4;
         }
         $group->save();
         if (!($x % 100)) {
             $this->info($x . ' groups processed');
         }
         $x++;
     }
     $this->info('All groups processed');
 }
Ejemplo n.º 19
0
 /**
  * The MarkdownGenerator constructor.
  *
  * @constructor
  * @param {string} $source The source code to parse.
  * @param {Array} $options The options array.
  */
 public function __construct($source, $options = array())
 {
     // juggle arguments
     if (is_array($source)) {
         $options = $source;
     } else {
         $options['source'] = $source;
     }
     if (isset($options['source']) && realpath($options['source'])) {
         $options['path'] = $options['source'];
     }
     if (isset($options['path'])) {
         preg_match('/(?<=\\.)[a-z]+$/', $options['path'], $ext);
         $options['source'] = file_get_contents($options['path']);
         $ext = array_pop($ext);
         if (!isset($options['lang']) && $ext) {
             $options['lang'] = $ext;
         }
         if (!isset($options['title'])) {
             $options['title'] = ucfirst(basename($options['path'])) . ' API documentation';
         }
     }
     if (!isset($options['lang'])) {
         $options['lang'] = 'js';
     }
     if (!isset($options['toc'])) {
         $options['toc'] = 'properties';
     }
     $this->options = $options;
     $this->source = str_replace(PHP_EOL, "\n", $options['source']);
     $this->entries = Entry::getEntries($this->source);
     foreach ($this->entries as $index => $value) {
         $this->entries[$index] = new Entry($value, $this->source, $options['lang']);
     }
 }
Ejemplo n.º 20
0
 function add_entry_or_merge($entry)
 {
     if (is_array($entry)) {
         $entry = new Entry($entry);
     }
     $key = $entry->key();
     if (FALSE === $key) {
         return FALSE;
     }
     if (isset($this->entries[$key])) {
         $this->entries[$key]->merge_with($entry);
     } else {
         $this->entries[$key] =& $entry;
     }
     return TRUE;
 }
Ejemplo n.º 21
0
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Entry::create([]);
     }
 }
Ejemplo n.º 22
0
 protected function postFilter()
 {
     parent::postFilter();
     if ($this->folder !== null) {
         $this->xml->setAttribute('folder', $this->folder);
     }
 }
Ejemplo n.º 23
0
 public function show($groupName)
 {
     $group = Group::name($groupName)->with('creator')->firstOrFail();
     $group->checkAccess();
     $stats = ['contents' => intval(Content::where('group_id', $group->getKey())->count()), 'comments' => intval(Content::where('group_id', $group->getKey())->sum('comments')), 'entries' => intval(Entry::where('group_id', $group->getKey())->count()), 'banned' => intval(GroupBanned::where('group_id', $group->getKey())->count()), 'subscribers' => $group->subscribers, 'moderators' => intval(GroupModerator::where('group_id', $group->getKey())->count())];
     return array_merge($group->toArray(), ['stats' => $stats]);
 }
Ejemplo n.º 24
0
 function Save()
 {
     if (empty($this->entry_class)) {
         $this->entry_class = 'page';
     }
     return parent::Save();
 }
Ejemplo n.º 25
0
 function __construct($date, $title, $soundpath, $imagepath)
 {
     parent::__construct($date, $title, $imagepath);
     $this->soundpath = $soundpath;
     $this->imagepath = $imagepath;
     return $this;
 }
Ejemplo n.º 26
0
 /**
  * Returns the active entry or null if there is no active entry.
  * @return Entry || null
  */
 public function getActiveEntry()
 {
     if ($this->_activeEntryId === null) {
         return null;
     }
     return Entry::model()->findByPk($this->_activeEntryId, 'deleted=0');
 }
Ejemplo n.º 27
0
 public function insert(array $data)
 {
     // set to item entry
     if (empty($data['type'])) {
         $data['type'] = 'item';
     }
     return parent::insert($data);
 }
 /**
  * @test
  */
 function entryは複数まとめて保存可能()
 {
     $emapper = new EntryMapper(self::$pdo);
     $entry = new Entry();
     $entry->author = 'Mr. Dummy';
     $entry->title = 'Hello';
     $entry->content = 'Hello, World!';
     $entry->published = new DateTime();
     $entry2 = new Entry();
     $entry2->author = 'Mr. Dummy';
     $entry2->title = 'Hello2';
     $entry2->content = 'Hello, World!2';
     $entry2->published = new DateTime();
     $emapper->insert(array($entry, $entry2));
     $this->assertArrayHasKey('entryId', $entry->toArray());
     $this->assertArrayHasKey('entryId', $entry2->toArray());
 }
Ejemplo n.º 29
0
 public function __construct(\steam_room $room)
 {
     parent::__construct($room);
     $this->entryAttributes["employmentcompany"] = array("attributeName" => PORTFOLIO_PREFIX . "ENTRY_EMPLOYMENT_COMPANY", "label" => "Betrieb", "description" => "", "values" => "", "defaultValue" => "");
     $this->entryAttributes["employmentduration"] = array("attributeName" => PORTFOLIO_PREFIX . "ENTRY_EMPLOYMENT_DURATION", "label" => "Dauer", "description" => "", "values" => "", "defaultValue" => "");
     $this->entryAttributes["employmenttype"] = array("attributeName" => PORTFOLIO_PREFIX . "ENTRY_EMPLOYMENT_TYPE", "label" => "Art", "description" => "", "values" => array(array("name" => "", "value" => 0), array("name" => "Beschäftigung", "value" => 1), array("name" => "Praktikum", "value" => 2), array("name" => "Sonstiges", "value" => 3)), "defaultValue" => "");
     $this->entryAttributes["employmentposition"] = array("attributeName" => PORTFOLIO_PREFIX . "ENTRY_EMPLOYMENT_POSITION", "label" => "Position", "description" => "", "values" => array(array("name" => "", "value" => 0), array("name" => "Chemikant", "value" => 2), array("name" => "Chemielaborant", "value" => 3), array("name" => "Chemietechniker", "value" => 4), array("name" => "Industriemeister Chemie", "value" => 5), array("name" => "Sonstige", "value" => 6)), "defaultValue" => "");
 }
Ejemplo n.º 30
0
 public function exportData($columns, $sessionKey = null)
 {
     $entries = Entry::all();
     $entries->each(function ($subscriber) use($columns) {
         $subscriber->addVisible($columns);
     });
     return $entries->toArray();
 }