コード例 #1
0
        static public function category_select($categories = null, $item = null, $default_item = null, $parent_selectable = false)
        {
            // Did user select a specific category to post in?
            $catId = Params::getParam('catId');
            if(Session::newInstance()->_getForm('catId') != "") {
                $catId = Session::newInstance()->_getForm('catId');
            }

            if($categories == null) {
                if(View::newInstance()->_exists('categories')) {
                    $categories = View::newInstance()->_get('categories');
                } else {
                    $categories = osc_get_categories();
                }
            }

            if ($item == null) { $item = osc_item(); }

            echo '<select name="catId" id="catId">';
            if(isset($default_item)) {
                echo '<option value="">' . $default_item . '</option>';
            } else {
                echo '<option value="">' . __('Select a category') . '</option>';
            }

            if(count($categories)==1) { $parent_selectable = 1; };

            foreach($categories as $c) {
                if ( !osc_selectable_parent_categories() && !$parent_selectable ) {
                    echo '<optgroup label="' . $c['s_name'] . '">';
                    if(isset($c['categories']) && is_array($c['categories'])) {
                        ItemForm::subcategory_select($c['categories'], $item, $default_item, 1);
                    }
                } else {
                    $selected = ( (isset($item["fk_i_category_id"]) && $item["fk_i_category_id"] == $c['pk_i_id']) || (isset($catId) && $catId == $c['pk_i_id']) );
                    echo '<option value="' . $c['pk_i_id'] . '"' . ($selected ? ' selected="selected"' : '' ). '>' . $c['s_name'] . '</option>';
                    if(isset($c['categories']) && is_array($c['categories'])) {
                        ItemForm::subcategory_select($c['categories'], $item, $default_item, 1);
                    }
                }
            }
            echo '</select>';
            return true;
        }
コード例 #2
0
ファイル: index.php プロジェクト: oanav/closetshare
                        </div>
                    </div>
                    <h2 class="render-title separate-top"><?php 
_e('Category settings');
?>
</h2>
                    <div class="form-row">
                        <div class="form-label"><?php 
_e('Parent categories');
?>
</div>
                        <div class="form-controls">
                            <div class="form-label-checkbox">
                                <label>
                                    <input type="checkbox" <?php 
echo osc_selectable_parent_categories() ? 'checked="checked"' : '';
?>
 name="selectable_parent_categories" value="1" />
                            <?php 
_e('Allow users to select a parent category as a category when inserting or editing a listing ');
?>
                                </label>
                            </div>
                        </div>
                    </div>
                    <h2 class="render-title separate-top"><?php 
_e('Contact Settings');
?>
</h2>
                    <div class="form-row">
                        <div class="form-label"><?php 
コード例 #3
0
ファイル: hValidate.php プロジェクト: acharei/OSClass
/**
 * Validate if exist category $value and is enabled in db
 *
 * @param string $value
 * @return boolean
 */
function osc_validate_category($value)
{
    if (osc_validate_nozero($value)) {
        $data = Category::newInstance()->findByPrimaryKey($value);
        if (isset($data['b_enabled']) && $data['b_enabled'] == 1) {
            if (osc_selectable_parent_categories()) {
                return true;
            } else {
                if ($data['fk_i_parent_id'] != null) {
                    return true;
                }
            }
        }
    }
    return false;
}
コード例 #4
0
ファイル: index.php プロジェクト: pombredanne/ArcherSys
     </div>
 </div>
 <div class="form-row">
     <div class="form-label"><?php _e('Search page shows'); ?></div>
     <div class="form-controls">
         <input type="text" class="input-small" name="default_results_per_page" value="<?php echo osc_esc_html(osc_default_results_per_page_at_search()); ?>" />
         <?php _e('listings at most'); ?>
     </div>
 </div>
 <h2 class="render-title separate-top"><?php _e('Category settings'); ?></h2>
 <div class="form-row">
     <div class="form-label"><?php _e('Parent categories'); ?></div>
     <div class="form-controls">
         <div class="form-label-checkbox">
             <label>
                 <input type="checkbox" <?php echo ( osc_selectable_parent_categories() ? 'checked="checked"' : '' ); ?> name="selectable_parent_categories" value="1" />
         <?php _e('Allow users to select a parent category as a category when inserting or editing a listing '); ?>
             </label>
         </div>
     </div>
 </div>
 <h2 class="render-title separate-top"><?php _e('Contact Settings'); ?></h2>
 <div class="form-row">
     <div class="form-label"><?php _e('Attachments'); ?></div>
     <div class="form-controls">
         <div class="form-label-checkbox">
             <label>
                 <input type="checkbox" <?php echo ( osc_contact_attachment() ? 'checked="checked"' : '' ); ?> name="enabled_attachment" value="1" />
         <?php _e('Allow people to attach a file to the contact form'); ?>
             </label>
         </div>