Beispiel #1
0
/**
 * show a content snippet
 *
 * @param array $vars array of parameters
 *
 * @return string contentsnippet
 */
function ContentSnippet_show($vars = null)
{
    if (!is_array($vars) && @$vars->id) {
        $data = Core_cacheLoad('content_snippets', $vars->id . '-data');
        if ($data === false) {
            $data = dbRow('select * from content_snippets where id=' . $vars->id, 'content');
            $data['content'] = json_decode($data['content'], true);
            Core_cacheSave('content_snippets', $vars->id . '-data', $data);
        }
        if (!is_array($data['content']) || !count($data['content'])) {
            return '<p>' . __('This Content Snippet is not yet defined.') . '</p>';
        }
        // { no sub-pages
        if (!$data['accordion']) {
            return '<div class="content-snippet">' . $data['content'][0]['html'] . '</div>';
        }
        // }
        // { vertical accordion
        $id = 'cs-' . rand();
        if ($data['accordion_direction'] == '0') {
            $script = '
				function change_slide( ){
					var active = $( "#' . $id . '" ).accordion( "option", "active"  );
					var total = $( ".accordion-h3" ).length;
					active = ( active + 1 ) % total;
					$( "#' . $id . '" ).accordion( "activate", active );
					setTimeout( change_slide, 8000 );
				}
				$( "#' . $id . '" ).accordion( {
					\'heightStyle\':\'content\',
					\'beforeActivate\': function( ){
						clearTimeout( change_slide );
					}
				} );
				setTimeout( change_slide, 8000 );	
			';
            WW_addInlineScript($script);
            $html = '<div id="' . $id . '">';
            foreach ($data['content'] as $content) {
                $html .= '<h3 class="accordion-h3"><a href="#">' . htmlspecialchars($content['title']) . '</a></h3>';
                $html .= '<div>' . $content['html'] . '</div>';
            }
            $html .= '</div>';
            return $html;
        }
        // }
        // { horizontal accordion
        WW_addScript('content-snippet/frontend/jquery.hrzAccordion.js');
        WW_addCss('/ww.plugins/content-snippet/frontend/jquery.hrzAccordion.defaults.css');
        $html = '<ul class="hrzAccordion" id="' . $id . '">';
        $imgs = array();
        if ($data['images_directory'] && file_exists(USERBASE . '/f' . $data['images_directory'])) {
            $dir = new DirectoryIterator(USERBASE . '/f' . $data['images_directory']);
            foreach ($dir as $file) {
                if ($file->isDot()) {
                    continue;
                }
                $imgs[] = '/f' . $data['images_directory'] . '/' . $file->getFilename();
            }
        }
        sort($imgs);
        $i = 0;
        foreach ($data['content'] as $content) {
            $html .= '<li><div class="handle">';
            if (count($imgs) && isset($imgs[$i])) {
                $size = getimagesize(USERBASE . '/' . $imgs[$i]);
                $html .= '<img src="' . htmlspecialchars($imgs[$i]) . '" style="width:' . $size[0] . 'px;height:' . $size[1] . 'px" />';
            } else {
                $html .= htmlspecialchars($content['title']);
            }
            $html .= '</div>';
            $html .= $content['html'] . '</li>';
            ++$i;
        }
        $html .= '</ul><script defer="defer">$(function(){$("#' . $id . '").hrzAccordion({handlePos' . 'ition:"left",cycle:true,cycleInterval:4000});});</script>';
        return $html;
        return $data['accordion_direction'];
        // }
    }
    return '<p>' . __('This Content Snippet is not yet defined.') . '</p>';
}
Beispiel #2
0
/**
 * stub function to load frontend page-type
 *
 * @param object $PAGEDATA the current page
 *
 * @return string
 */
function OnlineStore_frontend($PAGEDATA)
{
    OnlineStore_setVat($PAGEDATA);
    require SCRIPTBASE . 'ww.plugins/online-store/frontend/index.php';
    WW_addCss('/ww.plugins/online-store/frontend/index.css');
    return $c;
}
Beispiel #3
0
        $ps = dbAll('select * from products_relations where relation_id=' . $relation['id'] . ' and from_id=' . $id);
        $options = '<option value=""> -- ' . __('Choose') . ' -- </option>';
        foreach ($relations as $r) {
            $options .= '<option value="' . $r['id'] . '"';
            if ($r['id'] == $relation['id']) {
                $options .= ' selected="selected"';
            }
            $options .= '>' . htmlspecialchars($r['name']) . '</option>';
        }
        foreach ($ps as $p) {
            echo '<tr><td><select name="product-relations-type[]">' . $options . '</select></td><td><select class="products-relations-product"' . ' name="products-relations-product[]">' . '<option value="' . $p['to_id'] . '">';
            echo htmlspecialchars(__FromJson(dbOne('select name from products where id=' . $p['to_id'], 'name'))) . '</option></select></td></tr>';
        }
    }
    echo '<tr><td><select name="product-relations-type[]">' . '<option value=""> -- ' . __('Choose') . ' -- </option>';
    foreach ($relations as $relation) {
        echo '<option value="' . $relation['id'] . '">' . htmlspecialchars($relation['name']) . '</option>';
    }
    echo '</select></td>' . '<td><select class="products-relations-product"' . ' name="products-relations-product[]">' . '<option value=""> -- ' . __('Choose') . ' -- </option></select>';
    WW_addScript('products/admin/products-edit-related.js');
    echo '</td></tr></table></div>';
}
// }
// { end form and tabs
echo '</div><input type="submit" value="' . __('Save') . '" /></form>';
// }
WW_addScript('products/admin/products-edit.js');
WW_addScript('products/admin/create-page.js');
WW_addScript('products/admin/add-category.js');
WW_addCss('/ww.plugins/products/admin.css');
WW_addInlineScript('$(function(){' . '$("#onTheFlyParent").remoteselectoptions({' . 'url:"/a/p=products/f=adminCategoriesGetRecursiveList"' . '})' . '})');
Beispiel #4
0
    $c .= '<h2>' . __('User blog rights', 'core') . '</h2>' . '<div><p>' . __('Along with administrators, what user groups should be allowed to' . ' create blog entries?', 'core') . '</p>';
    $allowed = array();
    if ($vars['blog_groupsAllowedToPost']) {
        $allowed = json_decode($vars['blog_groupsAllowedToPost'], true);
    }
    $c .= '<ul>';
    foreach ($groups as $g) {
        $c .= '<li>' . '<input type="checkbox" name="page_vars[blog_groupsAllowedToPost][' . $g['id'] . ']"';
        if (@$allowed[$g['id']]) {
            $c .= ' checked="checked"';
        }
        $c .= '/>' . htmlspecialchars($g['name']) . '</li>';
    }
    $c .= '</ul></div>';
}
// }
$c .= '</div></div>';
// }
// { header
$c .= '<div id="blog-header">' . '<p>' . __('This text will appear above <i>all</i> blog entries', 'core') . '</p>';
$c .= ckeditor('body', $page['body']);
$c .= '</div>';
// }
// { footer
$c .= '<div id="blog-footer">' . '<p>' . __('This text will appear below <i>all</i> blog entries', 'core') . '</p>';
$c .= ckeditor('page_vars[footer]', isset($vars['footer']) ? $vars['footer'] : '');
$c .= '</div>';
// }
$c .= '</div>';
WW_addCss('/ww.plugins/blog/admin/admin.css');
WW_addScript('blog/admin/admin.js');
Beispiel #5
0
/**
 * user profile page stuff for ads
 *
 * @param object $PAGEDATA page data
 * @param array  $user     user data
 *
 * @return text
 */
function Ads_userProfile($PAGEDATA, $user)
{
    WW_addScript('ads/user-profile.js');
    WW_addCss('/ww.plugins/ads/css.css');
    return '<div class="ui-widget ui-widget-content ui-corner-all" id="ad-stats">' . '<div class="ui-widget-header">Ad Statistics</div></div>';
}