Ejemplo n.º 1
0
 function save($post = null)
 {
     if ($post === null) {
         $post = JRequest::get('post');
     }
     $menuid = isset($post['id']) ? $post['id'] : 0;
     $otherMenuid = isset($post['menuIds']) ? $post['menuIds'] : array();
     $menuPtype = isset($post['profileTypes']) ? $post['profileTypes'] : array();
     $allTypes = XiptHelperProfiletypes::getProfileTypeArray();
     $model = $this->getModel();
     // menuid is also selected in otherMenuid then no need to add
     if (!in_array($menuid, $otherMenuid)) {
         array_push($otherMenuid, $menuid);
     }
     //remove all rows related to specific menu id
     foreach ($otherMenuid as $id) {
         $model->delete(array('menuid' => $id));
     }
     $msg = XiptText::_('MENU_SAVED');
     $link = XiptRoute::_('index.php?option=com_xipt&view=jstoolbar', false);
     $this->setRedirect($link, $msg);
     //if all selected, return true
     if (array_diff($allTypes, $menuPtype) == array()) {
         return true;
     }
     $ptypesToChange = array_diff($allTypes, $menuPtype);
     foreach ($ptypesToChange as $type) {
         foreach ($otherMenuid as $id) {
             if ($this->getModel()->save(array('menuid' => $id, 'profiletype' => $type)) == false) {
                 return false;
             }
         }
     }
     return true;
 }
Ejemplo n.º 2
0
 function isRequired()
 {
     $ptypes = XiptHelperProfiletypes::getProfileTypeArray();
     if ($ptypes) {
         return false;
     }
     return true;
 }
Ejemplo n.º 3
0
 function isApplicable()
 {
     $ptypes = XiptHelperProfiletypes::getProfileTypeArray();
     if ($ptypes) {
         return true;
     }
     return false;
 }
Ejemplo n.º 4
0
 function isRequired()
 {
     $ptypeArray = XiptHelperProfiletypes::getProfileTypeArray();
     $globalWM = XiptFactory::getSettings('show_watermark', 0);
     if ($globalWM) {
         return false;
     }
     foreach ($ptypeArray as $ptype) {
         $watermarkParams = XiptLibProfiletypes::getParams($ptype, 'watermarkparams');
         if ($watermarkParams->get('enableWaterMark', 0) == true) {
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 5
0
 function buildProfileTypesforJSToolbar($menuid)
 {
     $selectedTypes = self::getProfileTypeArray($menuid);
     $allTypes = XiptHelperProfiletypes::getProfileTypeArray();
     $html = '';
     $html .= '<span>';
     foreach ($allTypes as $option) {
         // XITODO : improve following condition
         $selected = in_array($option, $selectedTypes) || in_array(XIPT_PROFILETYPE_ALL, $selectedTypes) ? ' checked="checked"' : '';
         $html .= '<lable><input type="checkbox" id="profileTypes' . $option . '" name="profileTypes[]" value="' . $option . '"' . $selected . '" style="margin: 0 5px 5px 0;" />';
         $html .= XiptHelperProfiletypes::getProfileTypeName($option) . '</lable>';
         $html .= '<div class="clr"></div>';
     }
     $html .= '</span>';
     return $html;
 }
Ejemplo n.º 6
0
 function buildProfileTypes($fid, $for)
 {
     $selectedTypes = XiptHelperProfilefields::getProfileTypeArray($fid, $for);
     $allTypes = XiptHelperProfiletypes::getProfileTypeArray();
     $html = '';
     $categories = XiptHelperProfilefields::getProfileFieldCategories();
     $name = $categories[$for]['controlName'];
     $html .= '<span>';
     foreach ($allTypes as $option) {
         $selected = in_array($option, $selectedTypes) || in_array(XIPT_PROFILETYPE_ALL, $selectedTypes) ? ' checked="checked"' : '';
         $html .= '<lable><input type="checkbox" name= "' . $name . '[]" value="' . $option . '" ' . $selected . ' " style="margin: 0 5px 5px 0;" />';
         $html .= XiptHelperProfiletypes::getProfileTypeName($option) . '</lable>';
         $html .= '<div class="clr"></div>';
     }
     $html .= '</span>';
     return $html;
 }
Ejemplo n.º 7
0
 function buildProfileTypes($name, $value, $control_name, $fid)
 {
     $allTypes = XiptHelperProfiletypes::getProfileTypeArray(true, true);
     $html = '';
     $html .= '<select id="' . $control_name . '[' . $name . '][' . $fid . '][]" name="' . $control_name . '[' . $name . '][' . $fid . '][]" value="" style="margin: 0 5px 5px 0;"  size="3" multiple/>';
     foreach ($allTypes as $option) {
         $ptypeName = XiptHelperProfiletypes::getProfileTypeName($option);
         $selected = '';
         if (is_array($value) && array_key_exists($fid, $value) && in_array($option, $value[$fid])) {
             $selected = 'SELECTED';
         }
         $html .= '<option name="' . $name . '_' . $option . '" "' . $selected . '" value="' . $option . '">';
         $html .= XiptHelperProfiletypes::getProfileTypeName($option) . '</option>';
     }
     $html .= '</select>';
     return $html;
 }
Ejemplo n.º 8
0
 function save($post = null)
 {
     if ($post === null) {
         $post = JRequest::get('post');
     }
     $fid = isset($post['id']) ? $post['id'] : 0;
     $otherFids = isset($post['fieldIds']) ? $post['fieldIds'] : array();
     $allTypes = XiptHelperProfiletypes::getProfileTypeArray();
     $fieldModel = $this->getModel();
     // fid is also selected in otherAid then no need to add
     if (!in_array($fid, $otherFids)) {
         array_push($otherFids, $fid);
     }
     //remove all rows related to specific field id
     // cleaning all data for storing new profiletype with fields
     foreach ($otherFids as $id) {
         $fieldModel->delete(array('fid' => $id));
     }
     $categories = XiptHelperProfilefields::getProfileFieldCategories();
     // for each category
     foreach ($categories as $catIndex => $catInfo) {
         $controlName = $catInfo['controlName'];
         $selectedPtypes = isset($post[$controlName]) ? $post[$controlName] : array();
         // if all profile types are selected
         $ptypesToChange = array_diff($allTypes, $selectedPtypes);
         if ($ptypesToChange == array()) {
             continue;
         }
         // for each profile type
         foreach ($ptypesToChange as $type) {
             foreach ($otherFids as $id) {
                 if ($this->getModel()->save(array('fid' => $id, 'pid' => $type, 'category' => $catIndex)) == false) {
                     return false;
                 }
             }
         }
     }
     $msg = XiptText::_('FIELDS_SAVED');
     $link = XiptRoute::_('index.php?option=com_xipt&view=profilefields', false);
     $this->setRedirect($link, $msg);
     return true;
 }
Ejemplo n.º 9
0
 function isApplicable()
 {
     $plugin = XiptHelperUtils::getPluginStatus('xi_adminapproval');
     if (XIPT_JOOMLA_15) {
         if ($plugin && $plugin->published == 1) {
             return false;
         }
     } else {
         if ($plugin && $plugin->enabled == 1) {
             return false;
         }
     }
     $ptypeArray = XiptHelperProfiletypes::getProfileTypeArray();
     foreach ($ptypeArray as $ptype) {
         if (XiptHelperProfiletypes::getProfileTypeData($ptype, 'approve') == true) {
             return true;
         }
     }
     return false;
 }