'bicikli_hungary/data', 'callback' => 'bicikli_core_data', 'access' => user_access('access content'), 'type' => MENU_CALLBACK, ); $items[] = array( 'path' => 'biciklik', 'callback' => 'bicikli_core_lista', 'title' => 'Biciklik', 'access' => user_access('access content') ); $items[] = array( 'path' => 'alkatreszek', 'callback' => 'bicikli_alkatresz_lista', 'title' => 'Alkatrészek', 'access' => user_access('bicikli alkatresz bongeszo'), ); $items[] = array( 'path' => 'sajat-biciklik', 'callback' => 'bicikli_core_sajat_lista', 'title' => 'Saját biciklik', 'access' => user_access('access content') ); $items[] = array( 'path' => 'bicikli/szuro-sorrend', 'callback' => 'drupal_get_form', 'callback arguments' => array('bicikli_core_szuro_sorrend'), 'title' => 'Szűrő sorrend', 'access' => user_access('bicikli admin') ); $items[] = array( 'path' => 'bicikli/szuro-advanced', 'callback' => 'drupal_get_form', 'callback arguments' => array('bicikli_core_szuro_advanced'), 'title' => 'Szűrő avanced', 'access' => user_access('bicikli admin') ); $items[] = array( 'path' => 'admin/content/bicikli_alkatresz', 'description' => 'itt lehet megmondani, hogy mely tartalom típusok alkatrészek', 'callback' => 'drupal_get_form', 'callback arguments' => array('bicikli_alkatresz_admin'), 'title' => 'Bicikli alkatrészek', 'access' => user_access('bicikli admin') ); return $items; } function bicikli_core_sajat_lista($uid = 0){ global $user; if($uid ==0){ $uid = $user->uid; } $header = array( 'Bicikli', 'Ár', 'Tevékenységek', ); $res = db_query("SELECT n.nid, n.title, bc.ar FROM {node} n INNER JOIN {bicikli_core} bc ON n.nid=bc.nid WHERE n.uid=%d ORDER BY n.created",$uid); $lines = array(); while($row = db_fetch_object($res)){ $lines[$row->nid][] = l($row->title,'node/'.$row->nid); $lines[$row->nid][] = theme('bicikli_ar',$row->ar); $lines[$row->nid][] = l('Törlés', 'node/'. $row->nid .'/delete') .', '. l('Szerkesztés', 'node/'. $row->nid .'/edit'); } return theme('table',$header,$lines); } function theme_bicikli_ar($ar){ return number_format($ar,0,',',' ') .' Ft'; } function bicikli_core_lista($id = 0,$data = array()){ $output = ''; //form megjelenítése a szűrőkkel $output .= drupal_get_form('bicikli_core_szuro'); if(arg(1) == 'minden bicikli'){ $output .= '
Mivel nem választottál ki biciklit ezért megmutatjuk az összeset!
'; } //lekérés összrakása $where = bicikli_core_get_where(); $sql = "SELECT DISTINCT(n.nid) FROM {node} n LEFT JOIN {bicikli_core} bc ON n.nid=bc.nid".$where; //drupal_set_message('
'. print_r($sql,true) .'
'); //drupal_set_message('
'. print_r(preg_replace('/(DISTINCT\\(.*?\\))/','COUNT(\\1)',$sql),true) .'
'); //lista megjelenítése $res = pager_query($sql,100,0,preg_replace('/(DISTINCT\\(.*?\\))/','COUNT(\\1)',$sql)); $egyse = true; while($row = db_fetch_object($res)){ $egyse = false; $node= node_load($row->nid); if(isset($node->node_images) && is_array($node->node_images) && sizeof($node->node_images)>0){ $img = array_shift($node->node_images); $node->first_image = $img->thumbpath; } // $output .= theme('node',$node,true); } if($egyse && arg(1) != ''){ $output .= '
A keresésnek megfelelő bicikli nincs az adatbázisunkban.
'; } $output .= theme('pager'); return $output; } function theme_bicikli($node){ $output .='
'; if(isset($node->first_image)){ $output .= l('','node/'.$node->nid, array(), NULL, NULL, FALSE, true); } $output .= '

'. l($node->title,'node/'.$node->nid) .'

'; $output .= '
'. $node->body .'
'; $output .= '
'. $node->extrak .'
'; $output .= '
'; //$output .='
'. print_r($node,true) .'
'; return $output; } function theme_bicikli_core_szuro($form){ /* $output .= << .szuro_valaszto .form-item{ width: 150px; float:left; margin: 0; } .szuro_valaszto .form-item select{ width: 140px; float:left; } .szuro_extrak .form-item .form-item{ width: 100px; float:left; margin: 0; } div.szuro_extrak{ clear:both; } div.szuro_valaszto{ clear:both; } div.szuro_valaszto fieldset{ clear:both; } div.bicikli img{ float:left; border: 1px solid #999; margin: 0 5px 5px 0; padding: 4px; backgorund-color: #ccc; } div.bicikli div.extrak{ clear:both; } END; */ $alja = '
'. drupal_render($form['Extrak']) .'
'; $alja .= drupal_render($form['submit']); $output .= '
'. drupal_render($form) .'
'; return $output . $alja; } function bicikli_core_get_where(){ $data = bicikli_core_parse_path(); $taxonomy = bicikli_core_get_term(); $vocabulary = bicikli_core_get_voc(); /* { $joins = ''; $wheres = ''; foreach ($descendant_tids as $index => $tids) { $joins .= ' INNER JOIN {term_node} tn'. $index .' ON n.nid = tn'. $index .'.nid'; $wheres .= ' AND tn'. $index .'.tid IN ('. implode(',', $tids) .')'; } $sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n '. $joins .' WHERE n.status = 1 '. $wheres .' ORDER BY '. $order; drupal_set_message($sql); $sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n '. $joins .' WHERE n.status = 1 '. $wheres; } tehát az ar megye varos marad, a többit viszont így kell belerakni. Egyelőre, mert el kell gondolkodni az egytáblás megoldáson, hogy gyorslegyen a select. */ $where = array(); $joins = ' '; $where[] = 'n.status=1'; $where[] = "n.type='bicikli'"; $order = ' ORDER BY n.promote DESC,n.sticky DESC, n.created DESC'; $index = 0; $alapi = sizeof($where); foreach($data as $key => $value){ switch($key){ case 'sorrend' : switch($value[0]){ case 'ar' : $order.= ',bc.ar ASC'; break; case 'ard' : $order.= ',bc.ar DESC'; break; case 'ido' : $order.= ',n.created ASC'; break; case 'idod' : $order.= ',n.created DESC'; break; } break; case 'ar' : list($alja,$teteje) = explode('-',$value[0]); if(is_numeric($alja) && is_numeric($teteje) && (int)$alja < (int)$teteje){ $where[] = 'bc.ar>='. (int)$alja .' and bc.ar<='.(int)$teteje; } if(is_numeric($alja) && $teteje === ''){ $where[] = 'bc.ar>='.(int)$alja; } break; case 'megye' : if(is_numeric($value[0])){ $where[] = 'bc.megye='.(int)$value[0]; } //drupal_set_message(print_r($where,true)); break; case 'varos' : if(is_numeric($value[0])){ $where[] = 'bc.varos='.(int)$value[0]; } break; default : if(is_array($value)){ $vid = $vocabulary['name'][$key]; foreach($value as $v){ if(isset($taxonomy['name'][$v][$vid])){ $joins .= ' INNER JOIN {term_node} tn'. $index .' ON n.nid = tn'. $index .'.nid'; $where[] = 'tn'. $index .'.tid='. (int)$taxonomy['name'][$v][$vid]; $index++; //$wheres .= 'tn'. $index .'.tid IN ('. implode(',', $tids) .')'; } } } break; } } /* if(sizeof($where) == $alapi){ $where[] = 'n.promote=1'; }*/ if(arg(1) ==''){ $where[] = 'n.promote=1'; } if(sizeof($where)>0){ return $joins.' WHERE '. join(' and ',$where) . $order; } return ''; } function bicikli_core_szuro(){ // drupal_set_message('
'. print_r(taxonomy_get_vocabularies('bicikli'),true) .'
'); $data = bicikli_core_parse_path(); $form['ar'] = array( '#type' => 'select', '#options' => bicikli_core_get_ar(), '#default_value' => isset($data['ar'])?$data['ar'][0]:bicikli_ALL, '#weight' => variable_get('bicikli_core_ar',0), '#title' => 'Ár', ); $form['megye'] = array( '#type' => 'select', '#title' => 'Megye', '#default_value' => isset($data['megye'])?$data['megye'][0]:bicikli_ALL, '#weight' => variable_get('bicikli_core_megye',0), '#options' => bicikli_get_megye(), ); //ezt kell visszatenni, hogy legyen a keresésnél város. /* $form['varos'] = array( '#type' => 'select', '#title' => 'Város', '#default_value' => isset($data['varos'])?$data['varos'][0]:bicikli_ALL, '#weight' => variable_get('bicikli_core_varos',0), '#options' => bicikli_get_varos(isset($data['megye'])?$data['megye'][0]:bicikli_ALL), );*/ $form['advanced'] = array( '#type' => 'fieldset', '#title' => t('Advanced search'), '#weight' => 99, '#collapsible' => TRUE, '#collapsed' => TRUE, ); $voc = taxonomy_get_vocabularies('bicikli'); $m = 0; foreach($voc as $vid => $vocab){ $name = bicikli_core_get_name($vocab->name); if($vocab->multiple != 1){ $element = array( '#type' => 'select', '#options' => bicikli_core_get_term_options($vid), '#default_value' => isset($data[$name])?$data[$name][0]:bicikli_ALL, '#title' => $vocab->name, '#weight' => $vocab->weight, ); if($vid == variable_get('bicikli_core_advanced', 0)){ $m = $vocab->weight; } if($vocab->weight < $m){ $form[$name] = $element; }else{ $form['advanced'][$name] = $element; } }else{ $form[$name] = array( '#type' => 'checkboxes', '#options' => bicikli_core_get_term_options($vid,true), '#default_value' => isset($data[$name])?$data[$name]:array(), '#title' => $vocab->name, '#weight' => $vocab->weight, ); } } $form['minden'] = array( '#type' => 'hidden', '#value' => 'bicikli', '#weight' => -100, ); $form['submit'] = array( '#type' => 'submit', '#value' => 'Keres', '#weight' => 100, ); return $form; } function bicikli_core_szuro_sorrend(){ $form['ar'] = array( '#type' => 'weight', '#default_value' => variable_get('bicikli_core_ar',0), '#weight' => variable_get('bicikli_core_ar',0), '#title' => 'Ár', ); $form['megye'] = array( '#type' => 'weight', '#default_value' => variable_get('bicikli_core_megye',0), '#weight' => variable_get('bicikli_core_megye',0), '#title' => 'Megye', ); $form['varos'] = array( '#type' => 'weight', '#default_value' => variable_get('bicikli_core_varos',0), '#weight' => variable_get('bicikli_core_varos',0), '#title' => 'Város', ); $voc = taxonomy_get_vocabularies('bicikli'); foreach($voc as $vid => $vocab){ $name = bicikli_core_get_name($vocab->name); $form[$name] = array( '#type' => 'weight', '#default_value' => $vocab->weight, '#title' => $vocab->name, '#weight' => $vocab->weight, ); } $form['submit'] = array( '#type' => 'submit', '#value' => 'Ment', '#weight' => 100, ); return $form; } function bicikli_core_szuro_advanced(){ $max = variable_get('bicikli_core_ar',0); if(variable_get('bicikli_core_megye',0) > $max){$max = variable_get('bicikli_core_megye',0);} if(variable_get('bicikli_core_varos',0) > $max){$max = variable_get('bicikli_core_varos',0);} $voc = taxonomy_get_vocabularies('bicikli'); $vr = array(); foreach($voc as $vid => $vocab){ if ($vocab->multiple == 0){ if($vocab->weight>$max){ $vr[$vid] = $vocab->name; } } } $vr[0] = 'Mindegyik látszik'; $form['bicikli_core_advanced'] = array( '#type' => 'radios', '#title' => t('Advanced'), '#default_value' => variable_get('bicikli_core_advanced', 0), '#options' => $vr, ); $form['submit'] = array( '#type' => 'submit', '#value' => 'Ment', '#weight' => 100, ); return $form; } function bicikli_core_szuro_advanced_submit($id,$form){ //drupal_set_message('
'. print_r($form,true) .'
'); variable_set('bicikli_core_advanced', $form['bicikli_core_advanced']); } function bicikli_core_szuro_sorrend_submit($id,$form){ //drupal_set_message('
'.print_r(  $vocabulary = bicikli_core_get_voc(),true).'
'); $vocabulary = bicikli_core_get_voc(); foreach($form as $name => $value){ //kiszedjük a felesleget if(!in_array($name,array('op','submit','form_id','form_token'))){ if(isset($vocabulary['name'][$name])){ db_query('UPDATE {vocabulary} SET weight=%d WHERE vid=%d',$value,$vocabulary['name'][$name]); }else if($name == 'ar' ||$name == 'varos' ||$name == 'megye'){ variable_set('bicikli_core_'.$name,$value); } } } } function bicikli_core_get_term_options($vid,$multiple = false){ $res = db_query('SELECT * FROM {term_data} WHERE vid = %d ORDER BY weight',$vid); if(!$multiple){ $ret[bicikli_ALL] = bicikli_ALL; } while($row = db_fetch_array($res)){ $ret[bicikli_core_get_name($row['name'])] = $row['name']; } return $ret; } function bicikli_core_parse_path(){ $ret = array(); $i=1; while($arg = arg($i++)){ $part = explode(' ',$arg); $name = array_shift($part); while(sizeof($part)>0){ if(trim($part[0]) !== ''){ $ret[$name][] = array_shift($part); }else{ array_shift($part); } } } return $ret; } function bicikli_core_get_ar(){ //visszaadja a z ár legördülő listát. return array( bicikli_ALL => bicikli_ALL, '0-5000'=>'0-5000', '5000-10000'=>'5000-10000', '10000-20000'=>'10000-20000', '20000-50000'=>'20000-50000', '50000-100000'=>'50000-100000', '100000-'=>'100000-', ); } function bicikli_core_szuro_submit($id,$data){ //drupal_set_message('
'. print_r(parse_ini_file(drupal_get_path('module','bicikli_core') .'/i18n.txt'),true) .'
'); //drupal_set_message('
'. print_r(taxonomy_get_vocabularies('bicikli'),true) .'
'); //drupal_set_message('
'. print_r(bicikli_core_get_term(),true) .'
'); //drupal_set_message('
'. print_r($data,true) .'
');return; $path='biciklik'; //biztos, ami biztos kiszedünk minden nem kellő karaktert. foreach($data as $name => $value){ //kiszedjük a felesleget if(!in_array($name,array('op','submit','form_id','form_token','minden'))){ if(is_array($value)){ //drupal_set_message('
'. print_r($value,true) .'
');return; $rv = array(); foreach($value as $v){ if($v != '0'){ $rv[] = bicikli_core_get_name($v); } } $value = join(' ',$rv); }else{ $value = bicikli_core_get_name($value); } $name = bicikli_core_get_name($name); if($value != bicikli_ALL && $value != ''){ $path.='/'. $name .' '. $value; } } } if(trim($path) == 'biciklik'){ $path .= '/minden bicikli'; } drupal_goto($path); } function bicikli_core_get_extra(){ $res = db_query("SELECT vid FROM {vocabulary} WHERE name='Extrák'"); $ret = db_fetch_object($res); return $ret->vid; } function bicikli_core_get_voc(){ $voc = taxonomy_get_vocabularies('bicikli'); $ret = array(); $ret['id'] = array(); $ret['name'] = array(); foreach ($voc as $id => $data){ $name = bicikli_core_get_name($data->name); $ret['id'][$id]=$name; $ret['name'][$name]=$id; } return $ret; } function bicikli_alkatresz_get_voc(){ $ret = array(); $ret['id'] = array(); $ret['name'] = array(); $alkatresz_tipusok = variable_get('bicikli_alkatresz_tipusok',array()); foreach($alkatresz_tipusok as $key => $val){ $voc = taxonomy_get_vocabularies($key); foreach ($voc as $id => $data){ $name = bicikli_core_get_name($data->name); $ret['id'][$id]=$name; $ret['name'][$name]=$id; } } return $ret; } function bicikli_core_get_term(){ $res = db_query('SELECT * FROM {term_data} ORDER BY tid'); $ret = array(); $ret['id'] = array(); $ret['name'] = array(); while($row = db_fetch_array($res)){ $name = bicikli_core_get_name($row['name']); $id = $row['tid']; $ret['id'][$id]=$name; $ret['name'][$name][$row['vid']] = $id; } return $ret; } function bicikli_core_get_name($name){ $csere = parse_ini_file(drupal_get_path('module','bicikli_core') .'/i18n.txt'); $name = strtr($name,$csere); $name = preg_replace('/[^a-zA-Z0-9-]+/','',$name); return $name; } function bicikli_core_data() { echo drupal_to_js(bicikli_get_varos((int)arg(2))); exit; } function bicikli_core_node_info() { return array( 'bicikli' => array( 'name' => 'Bicikli', 'module' => 'bicikli_core', 'description' => "Bicikli típus", 'has_title' => TRUE, 'title_label' => 'Megnevezés', 'has_body' => TRUE, 'body_label' => 'Leírás', ) ); } function bicikli_core_access($op, $node) { global $user; if ($op == 'create') { // Only users with permission to do so may create this node type. return user_access('create bicikli node'); } // Users who create a node may edit or delete it later, assuming they have the // necessary permissions. if ($op == 'update' || $op == 'delete') { if (user_access('edit own bicikli nodes') && ($user->uid == $node->uid)) { return TRUE; } } } /** * Implementation of hook_perm(). * * Since we are limiting the ability to create new nodes to certain users, * we need to define what those permissions are here. We also define a permission * to allow users to edit the nodes they created. */ function bicikli_core_perm() { return array('create bicikli node', 'edit own bicikli nodes','bicikli admin','bicikli alkatresz bongeszo'); } /** * Implementation of hook_form(). * * Now it's time to describe the form for collecting the information * specific to this node type. This hook requires us to return an array with * a sub array containing information for each element in the form. */ function bicikli_core_form(&$node) { // The site admin can decide if this node type has a title and body, and how // the fields should be labeled. We need to load these settings so we can // build the node form correctly. $type = node_get_types('type', $node); if ($type->has_title) { $form['title'] = array( '#type' => 'textfield', '#title' => check_plain($type->title_label), '#required' => TRUE, '#default_value' => $node->title, '#weight' => -5 ); } if ($type->has_body) { $form['body_filter']['body'] = array( '#type' => 'textarea', '#title' => check_plain($type->body_label), '#default_value' => $node->body, '#required' => ($type->min_word_count > 0), ); $form['body_filter']['format'] = filter_form($node->format); } // Now we define the form elements specific to our node type. $form['ar'] = array( '#type' => 'textfield', '#title' => 'Ár', '#required' => TRUE, '#default_value' => isset($node->ar) ? $node->ar : '', '#description' => 'Ár forintban. A mező csak egész számot tartalmazhat.', ); $form['megye'] = array( '#type' => 'select', '#title' => 'Megye', '#default_value' => isset($node->megye) ? $node->megye : 0, '#options' => bicikli_get_megye(), ); $form['varos'] = array( '#type' => 'select', '#title' => 'Város', '#default_value' => isset($node->varos) ? $node->varos : 0, '#options' => bicikli_get_varos(isset($_POST['megye'])?(int)$_POST['megye']:(isset($node->megye) ? $node->megye : 0)), ); return $form; } function bicikli_get_megye(){ static $megyek = false; if($megyek) {return $megyek;} $res = db_query("SELECT id, nev FROM {bicikli_hungary_telepulesek} WHERE megye=0 ORDER BY nev"); $megyek = array(); $megyek[bicikli_ALL] = bicikli_ALL; while($row = db_fetch_object($res)){ $megyek[$row->id] = $row->nev; } return $megyek; } function bicikli_get_varos($id = 0){ static $v = array(); if(isset($v[$id])) {return $v[$id];} if($id == 0){ $res = db_query("SELECT id, nev FROM {bicikli_hungary_telepulesek} WHERE megye<>0 && megye <>1 ORDER BY nev"); }else{ $res = db_query("SELECT id, nev FROM {bicikli_hungary_telepulesek} WHERE megye=%d ORDER BY nev",$id); } $varosok = array(); $varosok[bicikli_ALL] = bicikli_ALL; while($row = db_fetch_object($res)){ $varosok[$row->id] = $row->nev; } $v[$id] = $varosok; return $varosok; } function bicikli_core_validate(&$node) { if ($node->ar) { if (!preg_match('/^[0-9]+$/',$node->ar)) { form_set_error('ar', 'Az ár egész szám kell, hogy legyen!'); } } else { form_set_error('ar', 'Az árat meg kell adni!'); } } function bicikli_core_validate_alkatresz($form_id,$form) { if ($form['ar']) { if (!preg_match('/^[0-9]+$/',$form['ar'])) { form_set_error('ar', 'Az ár egész szám kell, hogy legyen!'); } } else { form_set_error('ar', 'Az árat meg kell adni!'); } } /** * Implementation of hook_insert(). * * As a new node is being inserted into the database, we need to do our own * database inserts. */ function bicikli_core_insert($node) { db_query("INSERT INTO {bicikli_core} (vid, nid, ar, megye, varos) VALUES (%d, %d, %d, %d, %d)", $node->vid, $node->nid, $node->ar, (int)$node->megye, (int)$node->varos); } /** * Implementation of hook_update(). * * As an existing node is being updated in the database, we need to do our own * database updates. */ function bicikli_core_update($node) { // if this is a new node or we're adding a new revision, if ($node->revision) { bicikli_core_insert($node); } else { db_query("UPDATE {bicikli_core} SET ar = %d, megye = %d, varos = %d WHERE vid = %d", $node->ar, (int)$node->megye, (int)$node->varos, $node->vid); } } /** * Implementation of hook_nodeapi(). * * When a node revision is deleted, we need to remove the corresponding record * from our table. The only way to handle revision deletion is by implementing * hook_nodeapi(). */ function bicikli_core_nodeapi(&$node, $op, $teaser, $page) { switch ($op) { case 'load': $vocabulary = bicikli_core_get_voc(); $e=array(); $to = array(); $e3 = array(); $esz = 0; $evid = bicikli_core_get_extra(); $taxonomy = taxonomy_node_get_terms($node->nid); foreach($taxonomy as $term){ $v = bicikli_core_get_name($vocabulary['id'][$term->vid]); $t = bicikli_core_get_name($term->name); $to[] = l($term->name,'sites/all/html/'. $v .'.html',array('rel'=>'clearbox(425,350,click)', 'title' => $term->name),NULL,$t); if($esz<3 && $term->vid != $evid){ $e3[] = $term->name; $esz ++; } if($term->vid == $evid){ //$e[] = l($term->name,'sites/all/html/'. $v .'.html',array('rel'=>'clearbox(425,350,click)', 'title' => $term->name),NULL,$t); // az extrakon nincs link $e[] = $term->name; } } $node->extrak = join(', ',$e); $node->alltaxonomy = join(', ',$to); $node->elsoharom = join(', ',$e3); $alkatresz_tipusok = variable_get('bicikli_alkatresz_tipusok',array()); if(in_array($node->type,$alkatresz_tipusok)){ $additions = db_fetch_array(db_query('SELECT ar, megye, varos FROM {bicikli_core} WHERE vid = %d', $node->vid)); $megyek = bicikli_get_megye(); $varosok = bicikli_get_varos($additions['megye']); $additions['megye_szoveg'] = $megyek[$additions['megye']]; $additions['varos_szoveg'] = $varosok[$additions['varos']]; return $additions; } break; case 'delete revision': // Notice that we're matching a single revision based on the node's vid. db_query('DELETE FROM {bicikli_core} WHERE vid = %d', $node->vid); break; case 'insert': case 'update': $alkatresz_tipusok = variable_get('bicikli_alkatresz_tipusok',array()); if(in_array($node->type,$alkatresz_tipusok)){ db_query('DELETE FROM {bicikli_core} WHERE nid = %d', $node->nid); db_query("INSERT INTO {bicikli_core} (vid, nid, ar, megye, varos) VALUES (%d, %d, %d, %d, %d)", $node->vid, $node->nid, $node->ar, (int)$node->megye, (int)$node->varos); } break; case 'delete': break; } } /** * Implementation of hook_delete(). * * When a node is deleted, we need to remove all related records from out table. */ function bicikli_core_delete($node) { // Notice that we're matching all revision, by using the node's nid. db_query('DELETE FROM {bicikli_core} WHERE nid = %d', $node->nid); } /** * Implementation of hook_load(). * * Now that we've defined how to manage the node data in the database, we * need to tell Drupal how to get the node back out. This hook is called * every time a node is loaded, and allows us to do some loading of our own. */ function bicikli_core_load($node) { $additions = db_fetch_object(db_query('SELECT ar, megye, varos FROM {bicikli_core} WHERE vid = %d', $node->vid)); $megyek = bicikli_get_megye(); $varosok = bicikli_get_varos($additions->megye); $additions->megye_szoveg = $megyek[$additions->megye]; $additions->varos_szoveg = $varosok[$additions->varos]; $voc = taxonomy_get_vocabularies('bicikli'); foreach($voc as $vid => $vocab){ if($vocab->multiple != 1){ $additions->vocabularys[$vocab->vid] = $vocab->name; } } return $additions; } /** * Implementation of hook_view(). * * This is a typical implementation that simply runs the node text through * the output filters. */ function bicikli_core_view($node, $teaser = FALSE, $page = FALSE) { $node = node_prepare($node, $teaser); /* ár, város, megye. $node->content['myfield'] = array( '#value' => theme('bicikli_core_order_info', $node), '#weight' => 1, ); */ return $node; } /** * Implementation of hook_theme(). * * This lets us tell Drupal about our theme functions and their arguments. */ function bicikli_core_theme() { /*return array( 'bicikli_core_order_info' => array( 'arguments' => array('node'), ), );*/ } function bicikli_core_get_taxonomy(){ /* $filter['ar'] = array( '#type' => 'options', '#options' => array( 0 => '0 - 1000', 1 => '1000 - 10 000', 2 => '10 000 - 100 000', 3 => '100 000 - ', ), );*/ $filter[''] = array( '#type' => 'tid', '#tid' => 0, ); $filter[''] = array( '#type' => 'tid', '#tid' => 0, ); $filter[''] = array( '#type' => 'tid', '#tid' => 0, ); } function bicikli_core_form_alter($form_id, &$form){ // a deltát felnöveljük 30-ra. //drupal_set_message('
'. print_r($form['#node']->ar,true) .'
'); // return; // _node_form drupal_set_message(substr($form_id,-10)); //drupal_set_message(substr($form_id,0,-10)); if(substr($form_id,-10) == '_node_form'){ $alkatresz_tipusok = variable_get('bicikli_alkatresz_tipusok',array()); if(in_array(substr($form_id,0,-10),$alkatresz_tipusok)){ //alkatrész típus, hozzáadjuk az árat, megyét, várost. $form['ar'] = array( '#type' => 'textfield', '#title' => 'Ár', '#required' => TRUE, '#default_value' => isset($form['#node']->ar) ? $form['#node']->ar : '', '#description' => 'Ár forintban. A mező csak egész számot tartalmazhat.', ); $form['megye'] = array( '#type' => 'select', '#title' => 'Megye', '#default_value' => isset($form['#node']->megye) ? $form['#node']->megye : 0, '#options' => bicikli_get_megye(), ); $form['varos'] = array( '#type' => 'select', '#title' => 'Város', '#default_value' => isset($form['#node']->varos) ? $form['#node']->varos : 0, '#options' => bicikli_get_varos(isset($_POST['megye'])?(int)$_POST['megye']:(isset($form['#node']->megye) ? $form['#node']->megye : 0)), ); $form['#validate'] = array('bicikli_core_validate_alkatresz' => array('ar')); } } foreach($form as $key => $input){ if(is_array($input) && isset($input['#type']) && $input['#type']=='weight' && $input['#delta'] < 10){ $form[$key]['#delta'] = 30; } } if(isset($form['taxonomy'][29])){ $form['taxonomy'][29]['#type'] = 'checkboxes'; $options = array(); if(is_array($form['taxonomy'][29]['#options'])){ foreach($form['taxonomy'][29]['#options'] as $akey => $value){ if(is_array($value->option)){ foreach($value->option as $key =>$val){ $options[$key] = $val; } } } } unset($form['taxonomy'][29]['#theme']); $form['taxonomy'][29]['#options'] = $options; } if($form_id == 'contact_mail_user'){ $bicaj = node_load((int)arg(3)); if($bicaj){ $form['subject']['#default_value'] = $bicaj->title; } } } function bicikli_alkatresz_admin(){ //drupal_set_message(print_r(taxonomy_get_vocabularies(),true)); $node_types = node_get_types(); $options = array(); foreach($node_types as $node_type){ $options[$node_type->type] = $node_type->name; } $form['#description'] = 'Állítsd be mely tartalom típusok alkatrészek'; $form['types'] = array( '#type' => 'checkboxes', '#title' => 'Tartalom típusok', '#options' => $options, '#description' => 'Állítsd be mely tartalom típusok alkatrészek', '#default_value' => variable_get('bicikli_alkatresz_tipusok',array()), ); $form['submit'] = array( '#type' => 'submit', '#value' => 'Mentés', ); return $form; } function bicikli_alkatresz_admin_submit($form_id,$form){ foreach($form['types'] as $key => $val){ if($key !== $val){unset($form['types'][$key]);} } variable_set('bicikli_alkatresz_tipusok',$form['types']); } function bicikli_alkatresz_lista(){ $output = ''; $output .= drupal_get_form('bicikli_alkatresz_kereso_form'); $terms = bicikli_core_get_term(); $vocabularys = bicikli_alkatresz_get_voc(); $where = array(); $values = array(); $fajta = $vocabularys['name'][arg(1)]; $tipus = $terms['name'][arg(2)][$fajta]; //drupal_set_message($tipus); if($tipus != 0){ $where [] = 'tn.tid=%d'; $values[] = $tipus; } $ar = arg(3); list($alja,$teteje) = explode('-',$ar); if(is_numeric($alja) && is_numeric($teteje) && (int)$alja < (int)$teteje){ $where[] = 'bc.ar>=%d and bc.ar<=%d'; $values[] = $alja; $values[] = $teteje; } if(is_numeric($alja) && $teteje === ''){ $where[] = 'bc.ar>=%d'; $values[] = $alja; } $megye = arg(4); if(is_numeric($megye)){ $where[] = 'bc.megye=%d'; $values[] = $megye; } if(count($where) != 0){ $sql = "SELECT bc.nid FROM {node} as n JOIN {bicikli_core} bc ON n.nid=bc.nid JOIN {term_node} tn ON bc.nid = tn.nid WHERE ". join(' AND ',$where) ." ORDER BY n.promote DESC,n.sticky DESC, n.created DESC"; //drupal_set_message($sql); $res = pager_query($sql,100,0,NULL,$values); $egyse = true; while($row = db_fetch_object($res)){ $egyse = false; $node= node_load($row->nid); if(isset($node->node_images) && is_array($node->node_images) && sizeof($node->node_images)>0){ $img = array_shift($node->node_images); $node->first_image = $img->thumbpath; } $output .= theme('node',$node,true); } if($egyse && arg(1) != ''){ $output .= '
A keresésnek megfelelő alkatrész nincs az adatbázisunkban.
'; } $output .= theme('pager'); } return $output; } function bicikli_alkatresz_kereso_form(){ drupal_add_js(drupal_get_path('module', 'bicikli_core') .'/bicikli_alkatresz.js'); $terms = bicikli_core_get_term(); $vocabularys = bicikli_alkatresz_get_voc(); $fajta = $vocabularys['name'][arg(1)]; $tipus = $terms['name'][arg(2)][$fajta]; $alkatresz_tipusok = variable_get('bicikli_alkatresz_tipusok',array()); $voc = taxonomy_get_vocabularies(); $termr = array(); foreach($voc as $v){ if(count(array_intersect($alkatresz_tipusok,$v->nodes))>0){ $res = db_query("SELECT * FROM {term_data} WHERE vid=%d",$v->vid); $tids = array(0 => '--Válassz!--'); while($row = db_fetch_array($res)){ $tids[$row['tid']] = $row['name']; } $form['term_'.$v->vid] = array( '#type' => 'select', '#title' => $v->name, '#options' => $tids, '#default_value' => $tipus, ); $termr[$v->vid] = $v->name; } } $form['terms'] = array( '#type' => 'select', '#title' => 'Alkatrész fajta', '#options' => $termr, '#default_value' => $fajta, ); $form['ar'] = array( '#type' => 'select', '#options' => bicikli_core_get_ar(), '#default_value' => arg(3), '#weight' => variable_get('bicikli_core_ar',0), '#title' => 'Ár', ); $form['megye'] = array( '#type' => 'select', '#title' => 'Megye', '#default_value' => arg(4), '#weight' => variable_get('bicikli_core_megye',0), '#options' => bicikli_get_megye(), ); $form['submit'] = array( '#type' => 'submit', '#value' => 'Keresés', ); return $form; } function bicikli_alkatresz_kereso_form_validate($form_id,$form){ // drupal_set_message('
'. print_r($form,true) .'
'); if(!is_numeric($form['terms']) || $form['terms'] == 0){ form_set_error('terms','Válasszon alkartrész fajtát!'); }else{ if($form['term_'. $form['terms']] == 0){ form_set_error('term_'. $form['terms'],'Válasszon alkartrész típust!'); } } } function bicikli_alkatresz_kereso_form_submit($form_id,$form){ $terms = bicikli_core_get_term(); $vocabularys = bicikli_alkatresz_get_voc(); $path[] = 'alkatreszek'; $path[] = $vocabularys['id'][$form['terms']]; $path[] = $terms['id'][$form['term_'. $form['terms']]]; $path[] = $form['ar']; $path[] = $form['megye']; drupal_goto(join('/',$path)); } Easy Methods To Locate an Excellent Shifting Company | Kerékpárpiac - Használt és új kerékpárok

Easy Methods To Locate an Excellent Shifting Company

Emailcím: contact2etscm@gmail.com
Telefonszám: 9718529568

How to Find a Good Packers and Movers in Bangalore

Packers and movers in Gurgaon
Packers and movers in Delhi

It would be a good decision to utilize services of professional packers and movers company in Bangalore whenever you have decided to go locally within the city of Bangalore or from this city to another city of Of india or abroad. A good mover may help with your move in the entire event from packing of the very first item at your current place to unpacking of the very last item at your new destination door step. But choosing a good packers and movers in Bangalore would be tricky and challenging activity for you since there are numerous removal companies or moving agencies or movers and packers in the location of Bangalore that can provide you required services for your move. Choosing the best one can make you worried. Here are some tips and tricks which might help you select the best Packers and Movers Bangalore at affordable and genuine rates. Have a look at them.

You know well that there are several professional movers and packers companies in the city of Bangalore. First of all; you will need to make a set of some of best rated and good quality moving companies of Bangalore after making some research work. You can do this in easy way by searching online or getting advice from your friends, relatives, colleagues and neighbors who have previously used the services of professional Bangalore movers and packers companies on their different moving and moving needs. You can also take help you advertisements published in your local newspapers, yellowpages or magazines. But getting suggestions would be the best method in my point of view.

Take a notebook and note down details of at the very least top 10 moving companies of Bangalore including company name, address, email ids, phone numbers, etc . Now it is time for checking credibility of these all companies. Visit their offices personally to know about their services, prices for move and other details. In case you don't have enough time to visit workplaces of several companies then make phone calls to them. Take them into questions in order to make certain that they registered, covered, experienced, knowledgeable and capable to handle your moving needs perfectly. Ask them about experience in the industry. Request details of their prior customers or clients also keep in mind to cross check. Also know about pricing and services for your move.

It is now time to narrow down your list. You must exclusive the emocionar from your list which is not registered, insured and experienced. Make sure you have at least top three companies in your last list. Make sure these three companies are offering quality services for your move within the budget you have thought for your move. Invite these about three Bangalore moving companies at the current place on different days or times. Demonstrate them all your belongings and possessions that you simply really want to pack and move to your new destination entrance step. Don't hire something with movers. Then ask them for written estimates. Don't accept moving quotations over the calls only. You must get it in written form.

Packers and movers in Mumbai

Today you have three best moving quotes from 3 different top quality Movers and Packers in Bangalore. Compare these quotes on your own carefully. Evaluate services and prices. Create final decision smartly to choose the best the one that will flawlessly match your moving needs at how big your pocket. I hope these ideas and tips aforementioned in this article will help you choose the favorable quality packers and movers company in Bangalore at your budget. So schedule your move with a good quality moving van of Bangalore and have hassle-free moving experience.

Vissza a lap tetejére