protected function get_default_access_group() { if (!isset($this->default_access_group)) { $da = reason_get_default_access(); $this->default_access_group = false; if ($group_id = $da->get($this->admin_page->site_id, 'av', 'av_restricted_to_group')) { $this->default_access_group = new entity($group_id); } } return $this->default_access_group; }
function get_default_restricted_group_id() { $da = reason_get_default_access(); return $da->get($this->manager->get_value('site_id'), $this->manager->get_value('type_id'), 'av_restricted_to_group'); }
protected function _create_media_entity($disco) { // put together the values for the entity $name = htmlspecialchars($disco->get_value('media_title')); $values = $this->params['default_values']; $values['name'] = $name; $values['new'] = "0"; $values['author'] = htmlspecialchars($disco->get_value('name')); if ($disco->get_value('class_year')) { switch (strlen($disco->get_value('class_year'))) { case 4: $values['author'] .= ' \'' . htmlspecialchars(mb_substr($disco->get_value('class_year'), -2)); break; case 3: $values['author'] .= htmlspecialchars($disco->get_value('class_year')); break; case 2: $values['author'] .= ' \'' . htmlspecialchars($disco->get_value('class_year')); } } $values['description'] = htmlspecialchars($disco->get_value('description')); $values['keywords'] = $name . ', ' . $values['author']; $values['entry_id'] = $this->_entry->id; $values['av_type'] = $disco->get_value('av_type'); $values['transcoding_status'] = 'converting'; $values['integration_library'] = 'kaltura'; $values['tmp_file_name'] = $this->_filename; // create the entity $this->_media_work_id = $id = reason_create_entity($this->site_id, id_of('av'), $this->_user_id, $name, $values); //$this->set_form_id($id); $page_id = $this->page_id; if (!empty($this->params['entries_gallery_page'])) { if (reason_unique_name_exists($this->params['entries_gallery_page'])) { $page_id = id_of($this->params['entries_gallery_page']); } else { trigger_error('Unable to find uniquely named page ' . $this->params['entries_gallery_page'] . '. Attaching photos to form page.'); } } create_relationship($page_id, $id, relationship_id_of('minisite_page_to_av')); // access restriction $da = reason_get_default_access(); if ($this->params['default_group_uname'] && reason_unique_name_exists($this->params['default_group_uname'])) { $group_id = id_of($this->params['default_group_uname']); create_relationship($id, $group_id, relationship_id_of('av_restricted_to_group')); } elseif ($group_id = $da->get($this->site_id, 'av', 'av_restricted_to_group')) { create_relationship($id, $group_id, relationship_id_of('av_restricted_to_group')); } return $id; }
protected function _create_media_entity($disco) { // put together the values for the entity $name = htmlspecialchars($disco->get_value('media_title')); $values = $this->params['default_values']; $values['name'] = $name; $values['new'] = "0"; $values['author'] = htmlspecialchars($disco->get_value('name')); if ($disco->get_value('class_year')) { switch (strlen($disco->get_value('class_year'))) { case 4: $values['author'] .= ' \'' . htmlspecialchars(mb_substr($disco->get_value('class_year'), -2)); break; case 3: $values['author'] .= htmlspecialchars($disco->get_value('class_year')); break; case 2: $values['author'] .= ' \'' . htmlspecialchars($disco->get_value('class_year')); } } $values['description'] = htmlspecialchars($disco->get_value('description')); $values['keywords'] = $name . ', ' . $values['author']; $values['av_type'] = $disco->get_value('av_type'); $values['integration_library'] = $this->_integration_library; $values['original_filename'] = $this->sanitize_filename($this->_filename); $values['salt'] = $this->get_salt(); $values['email_notification'] = true; if ($disco->get_value('url')) { $values['tmp_file_name'] = $disco->get_value('url'); } else { $values['tmp_file_name'] = basename($disco->get_element('upload_file')->tmp_full_path); } // create the entity $this->_media_work_id = $id = reason_create_entity($this->site_id, id_of('av'), $this->_user_id, $name, $values); //$this->set_form_id($id); $page_id = $this->page_id; if (!empty($this->params['entries_gallery_page'])) { if ('parent' == $this->params['entries_gallery_page']) { if ($pages =& $this->get_page_nav()) { if ($parent_page_id = $pages->parent($this->page_id)) { $page_id = $parent_page_id; } else { trigger_error('Unable to find parent page. Attaching photos to form page.'); } } else { trigger_error('Unable to find page tree. Attaching photos to form page.'); } } elseif (reason_unique_name_exists($this->params['entries_gallery_page'])) { $page_id = id_of($this->params['entries_gallery_page']); } else { trigger_error('Unable to find uniquely named page ' . $this->params['entries_gallery_page'] . '. Attaching photos to form page.'); } } create_relationship($page_id, $id, relationship_id_of('minisite_page_to_av')); // access restriction $da = reason_get_default_access(); if ($this->params['default_group_uname'] && reason_unique_name_exists($this->params['default_group_uname'])) { $group_id = id_of($this->params['default_group_uname']); create_relationship($id, $group_id, relationship_id_of('av_restricted_to_group')); } elseif ($group_id = $da->get($this->site_id, 'av', 'av_restricted_to_group')) { create_relationship($id, $group_id, relationship_id_of('av_restricted_to_group')); } return $id; }
protected function get_default_restricted_group_id() { $da = reason_get_default_access(); return $da->get($this->get_value('site_id'), $this->get_value('type_id'), 'asset_access_permissions_to_group'); }