Пример #1
0
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * Assemblies is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 */
$crud_type = get_input('crud');
$guid = get_input('guid');
$entity = get_entity($guid);
$crud = crud_get_handler($crud_type);
$msg_prefix = $crud->module . ":general";
$variables = array('periodicity' => 'text', 'chat' => 'text', 'streaming' => 'text', 'voip' => 'text', 'location' => 'text');
$input = array();
foreach ($variables as $name => $type) {
    $input[$name] = get_input($name);
}
// Get guids
$group = (int) get_input('guid');
elgg_make_sticky_form('assemblies_general');
foreach ($input as $name => $value) {
    $name = 'assembly_' . $name;
    $entity->{$name} = $value;
}
if ($entity->save()) {
    elgg_clear_sticky_form('assemblies_general');
Пример #2
0
/**
 * Register a crud class
 */
function crud_register_type($name, $variables, $class = NULL)
{
    crud_register_subtype($name, $class);
    $object = crud_get_handler($name);
    $prev_variables = elgg_get_config($name);
    if (!empty($prev_variables)) {
        $variables = array_merge($prev_variables, $variables);
    }
    elgg_set_config($name, $variables);
    $object->variables = $variables;
    if (empty($prev_variables)) {
        // Register for search.
        elgg_register_entity_type('object', $name);
        // routing of urls
        elgg_register_page_handler($name, 'crud_page_handler');
        // override the default url to view a crud object
        elgg_register_entity_url_handler('object', $name, 'crud_url_handler');
        $action_path = elgg_get_plugins_path() . 'crud/actions/crud';
        elgg_register_action("{$name}/save", "{$action_path}/save.php");
        elgg_register_action("{$name}/delete", "{$action_path}/delete.php");
        // icon url override
        elgg_register_plugin_hook_handler('entity:icon:url', 'object', 'crud_icon_url_override');
    }
    return $object;
}
Пример #3
0
/**
 * Push breadcrumbs from the given crud object going up in the parent hirarchy
 *
 * @param ElggObject $last Ending object
 * @param ElggObject $entity Current object
 * @param CrudTemplate $crud Crud template object
 */
function crud_push_breadcrumb($last, $entity, $crud = NULL)
{
    if (empty($crud)) {
        $crud = crud_get_handler($entity->getSubtype());
    }
    if ($entity->parent_guid) {
        $parent = get_entity($entity->parent_guid);
        crud_push_breadcrumb($last, $parent);
    } else {
        $group = $entity->getContainerEntity();
        elgg_push_breadcrumb($group->name, "{$crud->crud_type}/owner/{$entity->container_guid}");
    }
    $title = $entity->title;
    if (empty($title)) {
        $title = elgg_echo("{$crud->module}:{$crud->crud_type}");
    }
    if ($entity == $last) {
        elgg_push_breadcrumb($title);
    } else {
        elgg_push_breadcrumb($title, "{$crud->crud_type}/view/{$entity->guid}");
    }
}
Пример #4
0
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 *
 * @uses $vars['entity']    The crud object
 */
$entity = $vars['entity'];
$object_subtype = $entity->getSubtype();
$crud_object = crud_get_handler($object_subtype);
$children_categories = $crud_object->children_categories;
$variables = elgg_get_config($object_subtype);
foreach ($variables as $name => $type) {
    if (is_array($type)) {
        $type = elgg_extract('output_view', $type, elgg_extract('type', $type));
    }
    $value = $entity->{$name};
    if (in_array($name, array('title', 'description', 'access_id'))) {
        continue;
    }
    if (!$value) {
        continue;
    }
    if ($children_categories == $name) {
        continue;
Пример #5
0
 function getCrudTemplate()
 {
     return crud_get_handler($this->getSubType());
 }