Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F1614690
grnet_ldap_interconnection_sync.module~
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Mar 21, 2:41 AM
Size
2 KB
Mime Type
text/x-php
Expires
Mon, Mar 23, 2:41 AM (2 h, 3 m)
Engine
blob
Format
Raw Data
Handle
354150
Attached To
rMYACC myaccount custom drupal modules
grnet_ldap_interconnection_sync.module~
View Options
<?php
function grnet_ldap_interconnection_sync_menu() {
$items['grnet_ldap_sync/%/%'] = array(
'title' => 'Ldap Sync',
'page callback' => '_ldap_sync',
'page arguments' => array(1,2),
/*'access callback' => 'user_access',*/
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
function _ldap_sync($type,$vocabulary){
if($type=='units'){
if($vocabulary=='all'){
return _get_units('all');
}else{
return _get_units($vocabulary);
}
}
}
function _get_units($vid=NULL){
$output = 'Ξεκινάει ο Συγχρονισμός..';
$output .= '<br><br><br><br>';
if($vid=='all'){
$sql = "SELECT * FROM {taxonomy_vocabulary} WHERE vid IN (2,3,4,5,6) ";
}else{
$sql = db_query("SELECT * FROM {taxonomy_vocabulary} WHERE vid=:vid",array(':vid' => $vid) );
}
$result=db_query($sql);
foreach ($result as $rec) {
$output .= '<b>ΤΑΞΙΝΟΜΗΣΗ : '.$rec->description.'</b><br><br><br>';
$terms_array = taxonomy_get_tree($rec->vid, $parent = 0, $max_depth = NULL, TRUE);
foreach ($terms_array as $term) {
$output .= 'tid : '.$term->tid.'<br>';
$output .= 'name : '.$term->name.'<br>';
$output .= 'backend_name : '.$term->field_backend_name['und']['0']['value'].'<br>';
if(reset($term->parents) > 0){
$output .= 'parent : '.reset($term->parents).'<br>';
}
$entity = new stdClass();
$entity->name = $term->name;
$entity->field_backend_name = $term->field_backend_name;
$entity->vid = $term->vid;
$entity->tid = $term->tid;
if(reset($term->parents) > 0){
$entity->parent = $term->parents;
}
$res = grnet_ldap_interconnection_unit_create_wrapper($entity);
$output .= '<br>Ldap Status : ';
if($res==1){
$output .= '[OK]';
}else{
$output .= ' - ';
}
$output .= '<br><br>';
$output .= '------------------------------------<br><br>';
}
$output .= '
}
$output .= '<br><br><br><br>';
$output .= 'Ο συγχρονισμός ολοκληρώθηκε!!';
return $output;
}
?>
Event Timeline
Log In to Comment