示例#1
0
 public static function prtCat($categories, $category_act, $category_childs_act, $single = FALSE)
 {
     $DW =& $GLOBALS['DW'];
     foreach ($categories as $pid => $childs) {
         $run = TRUE;
         if ($DW->wpml) {
             include_once DW_MODULES . 'wpml_module.php';
             $wpml_id = DW_WPML::getID($pid, 'tax_category');
             if ($wpml_id > 0 && $wpml_id != $pid) {
                 $run = FALSE;
             }
         }
         if ($run) {
             $cat = get_category($pid);
             echo '<div style="position:relative;left:15px;">';
             echo '<input type="checkbox" id="' . ($single ? 'single_' : '') . 'category_act_' . $cat->cat_ID . '" name="' . ($single ? 'single_' : '') . 'category_act[]" value="' . $cat->cat_ID . '" ' . (isset($category_act) && count($category_act) > 0 && in_array($cat->cat_ID, $category_act) ? 'checked="checked"' : '') . '  onchange="chkChild(\'' . ($single ? 'single_' : '') . 'category\', ' . $pid . ');' . ($single ? 'ci(\'single_category_act_' . $cat->cat_ID . '\')' : '') . '" /> <label for="' . ($single ? 'single_' : '') . 'category_act_' . $cat->cat_ID . '">' . $cat->name . '</label><br />';
             echo '<div style="position:relative;left:15px;">';
             echo '<input type="checkbox" id="' . ($single ? 'single_' : '') . 'category_childs_act_' . $cat->cat_ID . '" name="' . ($single ? 'single_' : '') . 'category_childs_act[]" value="' . $cat->cat_ID . '" ' . (isset($category_childs_act) && count($category_childs_act) > 0 && in_array($cat->cat_ID, $category_childs_act) ? 'checked="checked"' : '') . ' onchange="chkParent(\'' . ($single ? 'single_' : '') . 'category\', ' . $cat->cat_ID . ');' . ($single ? 'ci(\'single_category_act_' . $cat->cat_ID . '\')' : '') . '" /> <label for="' . ($single ? 'single_' : '') . 'category_childs_act_' . $cat->cat_ID . '"><em>' . __('All childs', DW_L10N_DOMAIN) . '</em></label><br />';
             echo '</div>';
             if (count($childs) > 0) {
                 self::prtCat($childs, $category_act, $category_childs_act, $single);
             }
             echo '</div>';
         }
     }
 }
示例#2
0
     }
     break;
 case 'author':
     if (count($act) > 0 && is_author($act)) {
         $display = $other;
         $DW->message('Exception triggered for ' . $widget_id . ' sets display to ' . $e . ' (rule EA1)');
     }
     break;
 case 'category':
     if (count($act) > 0) {
         $act_cat = array();
         $act_childs = array();
         $id = get_query_var('cat');
         $DW->message('CatID: ' . $id);
         if (DW_WPML::detect(FALSE)) {
             $id = DW_WPML::getID($id, 'tax_category');
             $DW->message('WPML ObjectID: ' . $id);
         }
         foreach ($opt as $condition) {
             if ($condition->name != 'default') {
                 switch ($condition->maintype) {
                     case 'category':
                         $act_cat[] = $condition->name;
                         break;
                     case 'category-childs':
                         $act_childs[] = $condition->name;
                         break;
                 }
             }
         }
         if (in_array($id, $act_cat)) {
示例#3
0
 public static function prtTax($widget_id, $tax, $terms, $terms_act, $terms_childs_act, $prefix)
 {
     $DW =& $GLOBALS['DW'];
     // foreach ( $terms as $pid => $childs ) {
     foreach ($terms as $term) {
         $run = TRUE;
         /*				if ( $DW->wpml ) {
         					include_once(DW_MODULES . 'wpml_module.php');
         					$wpml_id = DW_WPML::getID($pid, 'tax_' . $tax);
         					if ( $wpml_id > 0 && $wpml_id <> $pid ) {
         						$run = FALSE;
         					}
         				} */
         if ($DW->wpml) {
             include_once DW_MODULES . 'wpml_module.php';
             $wpml_id = DW_WPML::getID($term->term_id, 'tax_' . $tax);
             if ($wpml_id > 0 && $wpml_id != $term->term_id) {
                 $run = FALSE;
             }
         }
         if ($run) {
             // $term = get_term_by('id', $pid, $tax);
             echo '<div style="position:relative;left:15px;">';
             echo '<input type="checkbox" id="' . $prefix . '_act_' . $term->term_id . '" name="' . $prefix . '_chkbx[]" value="' . $term->term_id . '" ' . (isset($terms_act) && count($terms_act) > 0 && in_array($term->term_id, $terms_act) ? 'checked="checked"' : '') . ' onchange="chkChild(\'' . $prefix . '\', ' . $term->term_id . ')" /> <label for="' . $prefix . '_act_' . $term->term_id . '">' . $term->name . '</label>';
             echo $terms_childs_act !== FALSE ? ' <span title=" Click to expand " onclick="term_tree(\'' . $widget_id . '\', \'' . $tax . '\', ' . $term->term_id . ', \'' . $prefix . '\');return false;"><img src="' . $DW->plugin_url . '/img/arrow-down.png" /></span>' : '';
             echo '<br />';
             if ($terms_childs_act !== FALSE) {
                 echo '<div id="child_' . $prefix . $term->term_id . '" style="position:relative;left:15px;display:none;">';
                 echo '<input type="checkbox" id="' . $prefix . '_childs_act_' . $term->term_id . '" name="' . $prefix . '_childs_chkbx[]" value="' . $term->term_id . '" ' . (isset($terms_childs_act) && count($terms_childs_act) > 0 && in_array($term->term_id, $terms_childs_act) ? 'checked="checked"' : '') . ' onchange="chkParent(\'' . $prefix . '\', ' . $term->term_id . ')" /> <label for="' . $prefix . '_childs_act_' . $term->term_id . '"><em>' . __('All childs', DW_L10N_DOMAIN) . '</em></label><br />';
                 echo '<div id="tree_' . $prefix . $term->term_id . '"></div>';
                 echo '</div>';
                 /* if ( count($childs) > 0 ) {
                 				self::prtTax($tax, $childs, $terms_act, $terms_childs_act, $prefix);
                 			} */
             }
             echo '</div>';
         }
     }
 }
 public static function prtTax($tax, $terms, $terms_act, $terms_childs_act, $prefix)
 {
     $DW =& $GLOBALS['DW'];
     foreach ($terms as $pid => $childs) {
         $run = TRUE;
         if ($DW->wpml) {
             include_once DW_MODULES . 'wpml_module.php';
             $wpml_id = DW_WPML::getID($pid, 'tax_' . $tax);
             if ($wpml_id > 0 && $wpml_id != $pid) {
                 $run = FALSE;
             }
         }
         if ($run) {
             $term = get_term_by('id', $pid, $tax);
             echo '<div style="position:relative;left:15px;">';
             echo '<input type="checkbox" id="' . $prefix . '_act_' . $pid . '" name="' . $prefix . '_act[]" value="' . $pid . '" ' . (isset($terms_act) && count($terms_act) > 0 && in_array($pid, $terms_act) ? 'checked="checked"' : '') . ' onchange="chkChild(\'' . $prefix . '\', ' . $pid . ')" /> <label for="' . $prefix . '_act_' . $pid . '">' . $term->name . '</label><br />';
             if ($terms_childs_act !== FALSE) {
                 echo '<div style="position:relative;left:15px;">';
                 echo '<input type="checkbox" id="' . $prefix . '_childs_act_' . $pid . '" name="' . $prefix . '_childs_act[]" value="' . $pid . '" ' . (isset($terms_childs_act) && count($terms_childs_act) > 0 && in_array($pid, $terms_childs_act) ? 'checked="checked"' : '') . ' onchange="chkParent(\'' . $prefix . '\', ' . $pid . ')" /> <label for="' . $prefix . '_childs_act_' . $pid . '"><em>' . __('All childs', DW_L10N_DOMAIN) . '</em></label><br />';
                 echo '</div>';
                 if (count($childs) > 0) {
                     self::prtTax($tax, $childs, $terms_act, $terms_childs_act, $prefix);
                 }
             }
             echo '</div>';
         }
     }
 }