/** * * @param MContainer $c * @param string $name * @param any $value */ public static function getFormElement(& $c, $name, $value){ $form = isset(self::$form2config[$name]) ? self::$form2config[$name] : array( "form" => 'text', "class" => '', "style" => '', "id" => '', "vertical" => 0 ); $style = isset($form["style"]) ? $form["style"] : ''; $class = isset($form["class"]) ? ' class="'. $form["class"] .'"' : ''; $id = isset($form["id"]) ? ' class="'. $form["id"] . '"' : ''; $parameters = $class.$id; switch($form['form']){ default: case 'text': $c->add( MForms::field($name,$value,null, $style, $parameters ) ); break; case 'textarea': $c->add( MForms::textArea($name,$value, $style, $parameters ) ); break; case 'select': $parameters .= $style ? ' style="'.$style.'"' : ''; foreach($form["options"] as & $option){ if(isset($option["text"])){ $option["text"] = MText::_($option["text"]); } } $c->add( MForms::select($name,$form['options'],$value,1, null, $parameters) ); break; }//EOF switch }
public static function rightsMaskFields($data = null, $rootFolderId = null){ $rightsObject = MRights::getInstance($rootFolderId); $rights = $rightsObject->getRightsFor($rootFolderId, $data->id); $calculated = $rightsObject->getCalculatedFor($rootFolderId,$data->id); $names = array("use","read","write"); $c = new MContainer(); $c->add('<div id="container_'.$data->id.'" style="padding: 10px;">'); $c->add('<table class="mRightsTable" id="table_'.$data->id.'" >'); $c->add('<tbody>'); $c->add('<tr id="tr_heading_'.$data->id.'" class="mNoSelect">'); $c->add('<td class="heading">'. MText::_("action").'</td>'); $c->add('<td class="heading">'. MText::_("selectnewsetting").'</td>'); $c->add('<td class="heading">'. MText::_("calculatedsetting").'</td>'); $c->add('</tr>'); foreach($names as $name){ $info = MText::_("rights_".$name."_desc"); $infoIcon = ($info != "rights_".$name."_desc" ) ? '<img src="'. _FM_HOME_FOLDER.'/images/info.png" align="right" info="'.$info.'" />' : ''; $isUse = ($name == "use") ? " is_use" : " no_use"; $hideMe = ($name == "use") ? '' : '<div class="hideme hideme_'.$data->id.'"></div></div>'; $c->add('<tr id="tr_'.$name.'_'.$data->id.'">'); $c->add('<td id="td_name_'.$name.'_'.$data->id.'" class="mNoSelect">'. MText::_("rights_".$name).$infoIcon.'</td>'); $select = MForms::select("right[".$data->id."][".$name."]",array( array("val"=> -1, "text"=>MText::_("inherited")), array("val"=> 0, "text"=>MText::_("denied")), array("val"=> 1, "text"=>MText::_("allowed")) ),$rights->get($name),1,null,' id="'.$name.'_'.$data->id.'" autocomplete="off" class="mRightSelect'.$isUse.' '.$isUse. '_' . $data->id .'" namespace="'.$name.'" group_id="'.$data->id.'" parent_id="'.$data->parent_id.'" calc_value="'.(int) $calculated->get($name).'"'); $c->add('<td id="td_action_'.$name.'_'.$data->id.'"> <div style="position: relative;">'. $select . $hideMe . '</div></td>'); $c->add('<td id="td_calc_'.$name.'_'.$data->id.'" class="mNoSelect"> <div style="position: relative">'. ( ($calculated->get($name)) ? '<span class="allowed'.$isUse.'_calc '.$isUse. '_calc_' . $data->id .'" id="calc_'.$name.'_'.$data->id.'" action_id="'.$name.'_'.$data->id.'">' . MText::_("allowed") . '</span>' : '<span class="notallowed'.$isUse.'_calc '.$isUse. '_calc_' . $data->id .'" id="calc_'.$name.'_'.$data->id.'" action_id="'.$name.'_'.$data->id.'">' . MText::_("notallowed") .'</span>'). $hideMe . '</div></td>'); $c->add('</tr>'); } $c->add('</tbody>'); $c->add('</table>'); if($data->isRoot){ $c->add('<div class="mSuperUsersAdviceDarken"></div><div class="mSuperUsersAdvice mNoSelect">'.MText::_("superusersrights").'</div>'); } $c->add('</div>'); return $c->get(); }